Package: django-custom-admin-pages
Django Custom Admin PagesA django app that lets you add standard class-based views to the django admin index and navigation. Create a view, register it like you would a ModelAdmin, and it appears in the Django Admin Nav.Check out thefull documentationfor more in-depth information.Quick StartInstall the app from pypipip install django_custom_admin_pagesRemovedjango.contrib.adminfrom your installed appsIn your django settings file add the following lines to your `INSTALLED_APPS``:INSTALLED_APPS=[# "django.contrib.admin", #REMOVE THIS LINE# ..."django_custom_admin_pages","django_custom_admin_pages.admin.CustomAdminConfig"# ...]UsageTo create a new custom admin view:Create a class-based view indjango_custom_admin_pages.viewswhich inherits fromcustom_admin.views.admin_base_view.AdminBaseView.Set the view class attributeview_nameto whatever name you want displayed in the admin index.Register the view similar to how you would register a ModelAdmin using a custom admin function:admin.site.register_view(YourView).Use the templatedjango_custom_admin_pages.templates.base_custom_admin.htmlas a sample for how to extend the admin templates so that your view has the admin nav.Also seetest_proj.test_app.views.example_view.pyExample:## in django_custom_admin_pages.views.your_special_view.pyfromdjango.contribimportadminfromdjango.views.genericimportTemplateViewfromdjango_custom_admin_pages.views.admin_base_viewimportAdminBaseViewclassYourCustomView(AdminBaseView,TemplateView):view_name="My Super Special View"template_name="my_template.html"route_name="some-custom-route-name"# if omitted defaults to snake_case of view_nameapp_label="my_app"# if omitted defaults to "django_custom_admin_pages". Must match app in settings# always call super() on get_context_data and use it to start your context dict.# the context required to render admin nav-bar is included here.defget_context_data(self,*args,**kwargs):context:dict=super().get_context_data(*args,**kwargs)# add your context ...returncontextadmin.site.register_view(YourCustomView)Your template should extendadmin/base.htmlorbase_custom_admin.htmltemplate:<!-- my_template.html -->{% extends 'base_custom_admin.html' with title="your page title" %} 
{% block content %}<h1>Hello World</h1>{% endblock %}Important: Custom Views Must Be Registered Before Admin URLs are LoadedBe sure to import the files where your views are stored prior to loading your root url conf. For example:# project/urls.pyfromdjango.contribimportadmin# importing view before url_patterns ensures it's registered!fromsome_app.viewsimportYourCustomViewurl_patterns=[path("admin/",admin.site.urls),...]Configurable SettingsCUSTOM_ADMIN_DEFAULT_APP_LABEL: set to override the default app_label (default:django_custom_admin_pages)ContributingReach out to the author if you'd like to contribute! Also free to file bug reports or feature requests viagithub issues.Local DevelopmentTo start the test_project:cd <repo_root>poetry install --with devpython test_proj/manage.py migratepython test_proj/manage.py createsuperuser(follow prompts)python test_proj/manage.py runserverNavigate toolocalhost:8000/admin, log in, and there should be one custom admin view.To run the test suite:poetry run pytestPrior to committing:Run pylint:cd <repo_root>poetry run pylint django_custom_admin_pages/Run black:poetry run black .Run isort:poetry run isort django_custom_admin_pages/