Django admin index modules is a Django app that gives you the ability to add widgets modules to the django admin dashboard (admin index)
Project description
Django admin index modules
Django admin index modules is a Django app that gives you the ability to add widgets modules to the django admin dashboard (admin index).
Quick start
- Installation:
pip install django-admin-index-modules
- comment "django.contrib.admin" and add "django_admin_index_modules.apps.CustomAdminConfig" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
#'django.contrib.admin',
'django_admin_index_modules.apps.CustomAdminConfig',
...
'django.contrib.staticfiles',
...
'django_admin_index_modules.apps.ModulesDashboardsConfig',
...
]
- In admin.py file of any other app create ypur widget module like this:
class VisitorsAdminModuleView(AdminModuleView):
template_name = 'visitors.html'
json_method_names = ['post']
http_method_names = ['get','post']
permissions = ['is_superuser']
css = []
js = []
def get(self, request, **kwargs):
context = {
'stats': "visitors"
}
return context
-
register your widget module using one of those methods:
-
- using register_module(AdminModuleView, position="middle_top") methods:
site.register_module(VisitorsAdminModuleView, position="middle_top")
-
- using @register_module(position="middle_top") decorator:
@register_module(position="middle_top")
class VisitorsAdminModuleView(AdminModuleView):
...
-
- position keyword can take one of those values: top, middle_top, middle_bottom and bottom
-
Visit http://127.0.0.1:8000/admin/ to see your widget module.
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
Close
Hashes for django_admin_index_modules-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13eda8c950ca42e2bed47cda79c204d403207c0fac07ffbb3ca869649de21908 |
|
MD5 | 9a15a5aee1b1d7be401e2a623c90e106 |
|
BLAKE2b-256 | 9c66e23651cb632b50aaabd9e99ffb9b012bd0a61b9055562f554c6a9945d9ea |
Close
Hashes for django_admin_index_modules-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 878b823c83e13458993b2d339cde813235cf34d8c79b9013fae0818403cfaacd |
|
MD5 | eddbf4bcdbba530305ec59acc56edf73 |
|
BLAKE2b-256 | 29f07685ec174d57c2435e5a3740db481c20f9b2ccbb1cedf08a0de4f4eaae4f |