I implement read-only fields by using widgets that render html that
does not include any . For example, if I have a field called
hobby in a Customer model, in my form I have something like this:
self.fields["hobby"] = CharField(widget=DisplayHobbyField(customer),
required=False)
DisplayHobbyFie
You can also do that by overriding the form's __init__ :
http://stackoverflow.com/questions/324477/in-a-django-form-how-to-make-a-field-readonly-or-disabled-so-that-it-cannot-be
You can pass the user to init and disable fields depending on that
parameter.
- Paulo
On Sat, Mar 20, 2010 at 4:02 P
Le samedi 20 mars 2010 16:05:20, Peter Reimer a écrit :
> Hi Folks,
>
> I'm looking for a way to get the following done:
> Depending on different things (user, groups, rights, etc.) I want to
> show a form with fields that can either be changed or not. For
> example, a form with two fields for nam
Hi Folks,
I'm looking for a way to get the following done:
Depending on different things (user, groups, rights, etc.) I want to
show a form with fields that can either be changed or not. For
example, a form with two fields for name and hobby, an admin can
change both fields, a normal user can only
4 matches
Mail list logo