Skip to main content

Control the sort order of apps and models in the Django admin interface.

Project description

django-admin-sortkey

Control the sort order of apps and models in the Django admin interface.

This is an independent, unofficial third-party package. It is not affiliated with or endorsed by the Django Software Foundation.

Install

pip install django-admin-sortkey

Add to INSTALLED_APPS before django.contrib.admin:

INSTALLED_APPS = [
    "django_admin_sortkey",
    "django.contrib.admin",
    ...
]

Usage

Sort apps in the admin index

# myapp/apps.py
from django.apps import AppConfig

class MyAppConfig(AppConfig):
    name = "myapp"
    app_sort = 10  # lower appears first; omit to sort alphabetically after explicit ones

Sort models within an app

# myapp/admin.py
from django.contrib import admin
from .models import Invoice

@admin.register(Invoice)
class InvoiceAdmin(admin.ModelAdmin):
    model_sort = 1  # lower appears first within the app section

Apps and models without an explicit sort value fall back to alphabetical ordering and appear after all explicitly sorted ones.

How it works

Patches AdminSite.get_app_list() once at app startup (AppConfig.ready()). No Django source modifications. Zero rebase maintenance.

Running tests

pip install -e ".[dev]"
pytest

License

BSD-3-Clause, matching Django's own license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_sortkey-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_sortkey-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_sortkey-0.1.0.tar.gz.

File metadata

  • Download URL: django_admin_sortkey-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_admin_sortkey-0.1.0.tar.gz
Algorithm Hash digest
SHA256 05acf704e3defea1ac03ff5b25b7ae1277955221399dea8066b33c9789b6f1f7
MD5 2d5c00613e6c38954f69a2f432826c0c
BLAKE2b-256 103f02ea8feb103bfb74cf3f931b9d55b7739fef5bed05a09bd3df551bcca07e

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_admin_sortkey-0.1.0.tar.gz:

Publisher: publish.yml on omidshojaee/django-admin-sortkey

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_admin_sortkey-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_sortkey-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2df52cea4c8d5de7c47c0dba68c391f2a25601b31feb51d32dbbb6fb670c45e3
MD5 981a21fb778a4d3087a6b0803d2774ca
BLAKE2b-256 a3e6b03fad1c50b5b1543940b0b50fceec2c69058d0e737481d63c5d3ca3ff7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_admin_sortkey-0.1.0-py3-none-any.whl:

Publisher: publish.yml on omidshojaee/django-admin-sortkey

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page