Actually I do to set permission to each field. A field in the form can be viewable and editable, only viewable, or hidden. So if user has a permission to see the form, but edit some fields in the form, it gets very tricky especially for validation. For example I used these statements to make readonly field : self.fields[name].widget.attrs['disabled'] = 'disabled' self.fields[name].widget.attrs['readonly']=True Then the problem rises not to be able send disabled fields in the post.
On Tuesday, March 22, 2016 at 9:31:43 AM UTC-4, bobhaugen wrote: > > Maybe you already know this, but you can do a lot of form tinkering in > __init__, like so: > > def __init__(self, permissions_parameter=None, *args, **kwargs): > super(FormName, self).__init__(*args, **kwargs) > if permissions_parameter: > #do a bunch of form tinkering > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/877bb8f8-4b59-4353-a0e5-99e95f55811b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.