How To Collapse Just One Field in Django Admin?

Posted by Apreche on Stack Overflow See other posts from Stack Overflow or by Apreche
Published on 2010-03-10T20:57:30Z Indexed on 2010/03/19 13:51 UTC
Read the original article Hit count: 215

The django admin allows you to specify fieldsets. You properly structure a tuple that groups different fields together. You can also specify classes for certain groups of fields. One of those classes is collapse, which will hide the field under a collapsable area. This is good for hiding rarely used or advanced fields to keep the UI clean.

However, I have a situation where I want to hide just one lonesome field on many different apps. This will be a lot of typing to create a full fieldset specification in every admin.py file just to put one field into the collapsed area. It also creates a difficult maintenance situation because I will have to edit the fieldset every time I edit the associated model.

I can easily exclude the field entirely using the exclude option. I want something similar for collapse. Is this possible?

© Stack Overflow or respective owner

Related posts about python

Related posts about django