Skip to main content

Django Admin Anchors

PyPI PyPI - Python Version PyPI - Django Version Downloads Codecov License

Turn Django admin list display items into clickable links to related objects using decorators.

Clicking admin anchors will redirect to a filtered changelist view showing the related objects. This allows you to get a quick overview and run actions on the filtered objects.

Installation

pip install django-admin-anchors

Usage

Take a look at the tests/project directory to see a runnable example project.

Object list page (light mode) Object list page (dark mode)

from django.contrib import admin
from admin_anchors import admin_anchor
from yourapp.models import Team


@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
    list_display = ["__str__", "captain_link", "captains_profile_link", "members_link"]

    @admin_anchor("captain")
    def captain_link(self, instance):
        return str(instance.captain)

    @admin_anchor("captain.profile")
    def captains_profile_link(self, instance):
        return "Captains profile"

    @admin_anchor("members")
    def members_link(self, instance):
        return f"{instance.members.count()} members"

Object change page (light mode) Object change page (dark mode)

from django.contrib import admin
from admin_anchors import admin_anchor
from yourapp.models import Player


@admin.register(Player)
class PlayerAdmin(admin.ModelAdmin):
    readonly_fields = ["profile_link"]

    @admin_anchor("profile")
    def profile_link(self, instance):
        return "Profile"

Example project

Take a look at our Django example project under tests/project. You can run it by executing these commands:

  1. uv sync
  2. uv run tests/project/manage.py migrate
  3. uv run tests/project/manage.py createsuperuser
  4. uv run tests/project/manage.py runserver

Metadata

Release files for django-admin-anchors 5.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-anchors 5.0.0
File Size Uploaded Provenance Actions
django_admin_anchors-5.0.0.tar.gz 4.4 kB Without provenance Details for django_admin_anchors-5.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-anchors 5.0.0
File Interpreter ABI Platform Actions
django_admin_anchors-5.0.0-py3-none-any.whl Python 3 none any Details for django_admin_anchors-5.0.0-py3-none-any.whl

Total release size: 9.7 kB

Release files / django_admin_anchors-5.0.0.tar.gz

Download URL django_admin_anchors-5.0.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
157e1aaa1b45b8a5a96950615edc37e9f27cb720be96f360d165162f3a9e4b0f
BLAKE2b-256 checksum
How to use checksums
dcf8ac0741533abc472f9820dab7ac11c99ea7f472664926ca31e228b43dc023
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / django_admin_anchors-5.0.0-py3-none-any.whl

Download URL django_admin_anchors-5.0.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
897684fb6ac2687b042da95ae57f0bccf5e6bce548c930881a16803754ca7810
BLAKE2b-256 checksum
How to use checksums
c4e2e72f9cf3c85b8a1b24dc016c09d83becb3df1e99e5220d2da024defa0688
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for django-admin-anchors 5.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page