Utility code and patterns.
Project description
Utility code and patterns.
Free software: BSD 2-Clause License
Installation
pip install django-admin-utils
You can also install the in-development version with:
pip install https://github.com/ionelmc/django-admin-utils/archive/master.zip
Documentation
Terse admin.py
from django.contrib import admin from admin_utils import register, inline from .models import MyModel, OtherModel @register(MyModel) class MyModelAdmin(admin.ModelAdmin): inlines = inline(OtherModel),
If you want custom admin sites:
customsite = admin.AdminSite() @register(MyModel, site=customsite) class MyModelAdmin(admin.ModelAdmin): inlines = inline(OherModel),
Mock admin (mount your views in admin using model wrappers)
Have you ever wanted a page in the admin that appears in the app list but you don’t have any models ? Now you can have that without patching up the admin Site or the templates. Just put this in your admin.py:
from django.conf.urls import patterns, url from admin_utils import make_admin_class make_admin_class("Test1", patterns("test_app.views", url(r'^$', 'root', name='test_app_test1_changelist'), url(r'^level1/$', 'level1', name='level-1'), url(r'^level1/level2/$', 'level2', name='level-2'), ), "test_app")
To use different admin site:
make_admin_class("Test1", patterns("test_app.views", url(r'^$', 'root', name='test_app_test1_changelist'), url(r'^level1/$', 'level1', name='level-1'), url(r'^level1/level2/$', 'level2', name='level-2'), ), "test_app", site=customsite)
Admin mixins
admin_utils.mixins.FoldableListFilterAdminMixin
Adds nice filter toggling with cookie support. Largely based on django-foldable-list-filter but without the transition effect and no pictures.
Example:
from admin_utils.mixins import FoldableListFilterAdminMixin class MyModelAdmin(FoldableListFilterAdminMixin, admin.ModelAdmin): pass
Looks like this:
admin_utils.mixins.FullWidthAdminMixin
Make the changelist expand instead of having the width of the windows and having that nasty inner scrollbar. You never gonna notice that if your table is long !
Example:
from admin_utils.mixins import FoldableListFilterAdminMixin class MyModelAdmin(FoldableListFilterAdminMixin, admin.ModelAdmin): pass
You probably didn’t even notice you had this problem:
Changelog
0.3.0 (2014-02-02)
Forgot to add any details.
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
Hashes for django_admin_utils-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af6abc7025789ff70f45d9a6f1c4a9fb5de5b721d867ee007b498f11918b2e94 |
|
MD5 | efbb712efe6b24e47ba354b055f73472 |
|
BLAKE2b-256 | 484daa99c344cc196a0ccdac66b7d02f6a45050a81a4f1ab7163441ed8a5808d |