Reusable Django admin mixin that turns ForeignKey fields into direct links to their related admin change views.
Project description
django-admin-fk-links
Reusable Django admin mixin that turns ForeignKey fields into direct clickable links to their related admin change views.
✨ Features
- ✅ Converts
ForeignKeyfields into clickable links inlist_display - ✅ Works with the default Django admin and custom
AdminSite - ✅ Zero configuration
- ✅ No need to add to
INSTALLED_APPS - ✅ Fully compatible with Django 2.2+
📦 Installation
pip install django-admin-fk-links
🚀 Quick Usage
from django.contrib import admin
from django_admin_fk_links import ForeignKeyLinkMixin
@admin.register(Book)
class BookAdmin(ForeignKeyLinkMixin, admin.ModelAdmin):
list_display = ("title", "author")
list_display_foreign_key_links = ("author",)
That’s it. The author column will now be a direct link to its admin change view.
⚙️ How It Works
The mixin dynamically replaces the fields listed in:
list_display_foreign_key_links = ("field_name",)
with callables that render an <a> tag pointing to the related object’s admin change view.
It also supports:
- Sorting via admin_order_field
- Automatic verbose_name resolution
- Custom AdminSite namespaces
✅ Compatibility
- Django 2.2+
- Python 3.7+
- Default admin.site ✅
- Custom AdminSite(name="custom") ✅
🪪 License
This project is licensed under the MIT License.
🤝 Contributing
Contributions, issues and feature requests are welcome. Feel free to open a PR or issue.
⭐ If you find it useful
Please consider giving the project a ⭐ on GitHub — it really helps!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_admin_fk_links-0.1.1.tar.gz.
File metadata
- Download URL: django_admin_fk_links-0.1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6943d2e73f897cf2db7edc77b3c919850b0a91fa7ef2bc449d8288129196b102
|
|
| MD5 |
fca8e444cf3caa65b830764decf8a1b5
|
|
| BLAKE2b-256 |
85301506a0bb16ce38b7f5fe42f9a8e4cf60e121df815289bd46d753d66729ce
|
Provenance
The following attestation bundles were made for django_admin_fk_links-0.1.1.tar.gz:
Publisher:
release.yml on rodolvbg/django-admin-fk-links
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_admin_fk_links-0.1.1.tar.gz -
Subject digest:
6943d2e73f897cf2db7edc77b3c919850b0a91fa7ef2bc449d8288129196b102 - Sigstore transparency entry: 747227225
- Sigstore integration time:
-
Permalink:
rodolvbg/django-admin-fk-links@6f5d66b3a272691f834f97870dd00638889270d8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rodolvbg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6f5d66b3a272691f834f97870dd00638889270d8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_admin_fk_links-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_admin_fk_links-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a893a1b40af5507e2da0c465ddec593c9d902d98f427c74d424ec6bfd0201d9
|
|
| MD5 |
130c26bd5c728d348a47c294cf1879d6
|
|
| BLAKE2b-256 |
bba55c3840e40d7985024ca34b8c646b5e07d42c35bc76c308657a67ac07507c
|
Provenance
The following attestation bundles were made for django_admin_fk_links-0.1.1-py3-none-any.whl:
Publisher:
release.yml on rodolvbg/django-admin-fk-links
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_admin_fk_links-0.1.1-py3-none-any.whl -
Subject digest:
2a893a1b40af5507e2da0c465ddec593c9d902d98f427c74d424ec6bfd0201d9 - Sigstore transparency entry: 747227228
- Sigstore integration time:
-
Permalink:
rodolvbg/django-admin-fk-links@6f5d66b3a272691f834f97870dd00638889270d8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rodolvbg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6f5d66b3a272691f834f97870dd00638889270d8 -
Trigger Event:
release
-
Statement type: