Skip to content

Commit

Permalink
more readme
Browse files Browse the repository at this point in the history
  • Loading branch information
KommuSoft committed Apr 13, 2024
1 parent dfe55ed commit e902e05
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ Next you can add the `django_admin_backref` to the `INSTALLED_APPS`:
# settings.py

INSTALLED_APPS = [
# …,
'django.contrib.admin',
# …,
'django_admin_backref',
#
]
```

Expand All @@ -52,3 +55,5 @@ The `.admin_links` will generate an `AdminLink` object. For each view name, it t
- <code>.get_<i>name</i>_label()</code>: a *safe* string that contains an `<a href="">` to that admin URL, and uses the label of the object as a method.

For a simple model and for a simple admin, so without additional packages, for the class we have `.add`, `.changelist`, for *instances* it also contains `.change`, `.delete` and `.history`. Additional packages like `django-import-export` or special `ModelAdmin`s like the one for the `User` model introduce additional paths, like for example `.import` and `.password_change`.

The label is determined by first calling `.get_label()` on the model object, if that does not work it takes the `str(…)` of the instance or model class. Finally if these raise an error, it will take the empty string.

0 comments on commit e902e05

Please sign in to comment.