콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
4959 화면

Hi,

I have a model with more than 15 fields. In this model I have `state` field which indicates if the record might be able to be modified or readonly.

Is there a convienient way to set all fields to `readonly` based on the state in my model,

a) in the view or
b) in the model itself.

I dont want to override the models `write` method since the fields on the frontend suggest the user that he can change the values. I event do not want to add `attrs="{'readonly':[('state','not','draft')]}"` to all the fields in my view!

I tried to add the above `attrs=...` to the `group` tags in the view, but that does not seem to work (V8 RC1).

Any suggestions for a handy way to handle my requirement?

Cheers!

아바타
취소
베스트 답변

Hi..

You can set the state attribute in python columns... That is the fesible option to lock your record based on a state value..

아바타
취소
관련 게시물 답글 화면 활동
3
8월 24
15892
6
9월 17
8267
11
9월 16
19717
1
3월 15
4479
2
3월 15
9978