toolkit.helpers.admin
– django-admin helpers¶
-
toolkit.helpers.admin.
auto_admin_register
(app_name, exclude=())¶ Helper allows you to register models to django-admin in bulk.
Register all unregistered models in the given app with the admin site. Any previously-registered models will retain their original registration.
Parameters: - app_name (string) – the name of the app to auto_admin_register.
- exclude (iterable) – an iterable of model names to exclude from registration
- Usage:
1 2 3 4
from polls.models import Poll from toolkit.admin import auto_admin_register auto_admin_register(__package__, exclude=(Poll.__name__, ))
- Recommended usage:
- make auto_admin_register(__package__) the last line in desired admin.py files.
Caution
Registers all models found in app_name that are not listed in exclude with the django-admin site.
- Author:
- Fredrick Wagner