Skip to content

matagus/django-admin-contexts

django-admin-contexts

Python Compatibility Django Compatibility PyPi Version CI badge codecov License

Display only a set of apps and models in the Django Admin homepage, based on the chosen context. This is useful when you have a lot of apps and models and you want to focus on a specific set of them.

Demo: selecting a context to display only a subset of models

Installation

Via pip command:

pip install django-admin-contexts

...or you can clone the repo and install it using pip too:

git clone git://github.com/matagus/django-admin-contexts.git
cd django-admin-contexts
pip install -e .

then add django_admin_contexts to your settings.py before django.contrib.admin:

INSTALLED_APPS = (
    # ...
    "django_admin_contexts",
    # ...
    "django.contrib.admin",
    # ...
)

then run the migrations:

python manage.py migrate

Usage

Browse to the Django Admin and create some contexts in the "Django Admin Contexts" section, associating them with one or more models.

Then, you can see the contexts in the Django Admin homepage.

Running Tests

Prerequisites: Install Hatch if not already installed: pip install hatch

List available test environments:

hatch env show test

Run all tests (all Python + Django combinations):

hatch run test:test

Run tests for specific Python/Django version:

hatch run test.py3.14-5.2:test  # Python 3.14 + Django 5.2
hatch run test.py3.12-5.1:test  # Python 3.12 + Django 5.1

Run specific test file:

hatch run test.py3.14-5.2:test tests.test_models

Coverage:

hatch run test:cov  # Run tests with coverage report

Troubleshooting: If you encounter environment issues, clean and rebuild: hatch env prune

Contributing

Contributions are welcome! โค๏ธ

Please read Contributing.md for detailed instructions on how to help.

License

django-admin-contexts is released under a BSD License

Acknowledgements

Develop & built using Hatch project linting - Ruff code style - black

About

๐Ÿ—ƒ๏ธ Display only a set of apps and models in the Django Admin homepage, based on the chosen context.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 2

  •  
  •