[patch] AdminOption property to set links on display_field fields
|Reported by:||Owned by:||Adrian Holovaty|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The attached patch add the ability to specify for which fields (among those listed in
display_fields) the admin interface will present a link to the related object edit page.
Currently, only the first field listed in
display_fields get a
<a href="obj_id/"> tag. For example, if you have
blank=True in your model for the first field, you won't be able to edit objects for which this field has been left blank. Moreover, you may want the admin interface to present links on several fields, or on an other field than the first one.
This patch add a
display_fields_links property to the AdminOption class, with the following constraints:
display_fieldsto be defined,
- fields specified in
display_fields_linksneed to be present in
display_fields_linksis omitted, the first of the
display_fieldsfields will still be used for links.
Since a picture is better than long sentences, an example is attached.