API Reference¶
RelativesAdmin¶
- class relatives.RelativesAdmin(model, admin_site)¶
ModelAdminthat links to related fields.This automatically applies a variation of the
object_linkutility to alllist_displayfields.
- class relatives.RelativesMixin¶
ModelAdminmixin that makes list display foreign keys linked.This is used by
RelativesAdmin. This can be used along with Django’s defaultModelAdmininstead of inheriting fromRelativesAdmin.
Utility Functions¶
- relatives.utils.get_admin_url(obj)¶
Return admin URL for given object (raise NoReverseMatch on error)
- relatives.utils.object_edit_link(edit_text=None, blank_text=None)¶
Return function that takes an object and returns admin link to object
Arguments:
edit_textis displayed in link textblank_textis displayed in unlinked text (when no admin link)
edit_textdefaults to the object’s unicode representation andblank_textdefaults to the object’s unicode representation ifedit_textis None and an empty string otherwise
- relatives.utils.object_link(obj)¶
Return admin link to given object or blank text if no link
Equivalent to object_edit_link()(obj)