editable=False? visible=False?

9 views
Skip to first unread message

patrickk

unread,
Aug 22, 2007, 6:27:32 AM8/22/07
to Django users
when using the field option "editable=False", the field is not
displayed in the admin at all.
is there a way to show the value of the field without making it
editable?

e.g, when I insert the current user on save, I´d like to display the
user in the change-form without having the possibility to edit the
user.

thanks,
patrick

Nathaniel Whiteinge

unread,
Aug 22, 2007, 1:16:41 PM8/22/07
to Django users
> is there a way to show the value of the field without making it
> editable?

This isn't possible by throwing an option into your field definition.

If you trust your Admin-site users, the easiest thing to do is
probably add the disabled [1]_ attribute to the element via custom
admin javascript [2]_.

.. [1] http://www.w3.org/TR/html401/interact/forms.html#disabled
.. [2] http://www.djangoproject.com/documentation/model-api/#js

- whiteinge

Reply all
Reply to author
Forward
0 new messages