[patch] AdminOption property to set links on display_field fields
|Reported by:||kilian <kilian.cavalotti@…>||Owned by:||adrian|
|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_fields_links needs display_fields to be defined,
- fields specified in display_fields_links need to be present in display_fields,
- if display_fields_links is omitted, the first of the display_fields fields will still be used for links.
Since a picture is better than long sentences, an example is attached.
Change History (8)
comment:3 Changed 8 years ago by adrian
- Resolution set to fixed
- Status changed from assigned to closed
comment:4 Changed 8 years ago by kilian <kilian.cavalotti@…>
- Resolution fixed deleted
- Status changed from closed to reopened