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:
from django_admin_index_modules.admin import AdminModuleView
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:
from django.contrib import admin
admin.site.register_module(VisitorsAdminModuleView, position="middle_top")
-
- using @register_module(position="middle_top") decorator:
from django_admin_index_modules.admin import register_module
@register_module(position="middle_top")
class VisitorsAdminModuleView(AdminModuleView):
...
-
- position keyword can take one of those values: top, middle_top, middle_bottom and bottom
-
create template file under "admin/modules/" than the name of the template file assigned to template_name propriety ex: "visitors.html"
-
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.2rc0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e57c71ed8d78046819b441849350e60a2168730d6b6b26f96c79bebd277e2af2 |
|
MD5 | 744370d3266443a88f02418e59d2d590 |
|
BLAKE2b-256 | f506737548d2669fc9567d3a09a246171b260477f978d4902cb7cf6c97a9a3ef |
Close
Hashes for django_admin_index_modules-1.0.2rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 181b179183f747aa0f8a3ed48d7288a026fce215f2a69bd772ae5eb7f98a0e03 |
|
MD5 | 22e819cbe18a4969558a1317d5d49c61 |
|
BLAKE2b-256 | 4d0d96b4f25cd430c163399c578fa162898dc6245094137bbb6b5b4ea2ee47b8 |