{"id":16417355,"url":"https://github.com/lekjos/django-custom-admin-pages","last_synced_at":"2025-10-26T20:30:31.254Z","repository":{"id":133094967,"uuid":"579564248","full_name":"lekjos/django-custom-admin-pages","owner":"lekjos","description":"A Django app that allows you to register class-based views to appear in Django admin.","archived":false,"fork":false,"pushed_at":"2024-05-20T06:29:19.000Z","size":351,"stargazers_count":57,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T04:35:33.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lekjos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-18T05:17:00.000Z","updated_at":"2025-01-03T13:44:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"889f39d1-5e76-4723-940f-003e14448313","html_url":"https://github.com/lekjos/django-custom-admin-pages","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekjos%2Fdjango-custom-admin-pages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekjos%2Fdjango-custom-admin-pages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekjos%2Fdjango-custom-admin-pages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekjos%2Fdjango-custom-admin-pages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lekjos","download_url":"https://codeload.github.com/lekjos/django-custom-admin-pages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238394323,"owners_count":19464583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T07:11:27.708Z","updated_at":"2025-10-26T20:30:31.241Z","avatar_url":"https://github.com/lekjos.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![PyPI](https://img.shields.io/pypi/v/django-custom-admin-pages)](https://pypi.org/project/django-custom-admin-pages/)\n![Python Supported](https://img.shields.io/badge/Python-_3.8,_3.9,_3.10,_3.11,_3.12,_3.13,_3.14-blue)\n![Django Supported](https://img.shields.io/badge/Django-3.2,_4.0,_4.1,_4.2,_5.0,_5.1,_5.2-blue)\n[![Tests](https://github.com/lekjos/django-custom-admin-pages/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/lekjos/django-custom-admin-pages/actions/workflows/build_and_test.yml)\n[![Docs](https://readthedocs.org/projects/django-custom-admin-pages/badge/?version=latest)](https://django-custom-admin-pages.readthedocs.io/en/latest/?badge=latest)\n[![CodeCov](https://codecov.io/gh/lekjos/django-custom-admin-pages/branch/master/graph/badge.svg?token=AJG2WICKXA)](https://codecov.io/gh/lekjos/django-custom-admin-pages)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/django-custom-admin-pages)\n\n\n# Django Custom Admin Pages\nA 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.\n\n![Example View](docs/source/static/example_view.png)\n\nCheck out the [full documentation](https://django-custom-admin-pages.readthedocs.io) for more in-depth information.\n\n\n## Quick Start\n\n1. Install the app from pypi `pip install django_custom_admin_pages`\n2. Remove `django.contrib.admin` from your installed apps\n3. In your django settings file add the following lines to your `INSTALLED_APPS``:\n\n```python\nINSTALLED_APPS = [\n   # \"django.contrib.admin\", #REMOVE THIS LINE\n   # ...\n   \"django_custom_admin_pages\",\n   \"django_custom_admin_pages.admin.CustomAdminConfig\"\n   # ...\n]\n```\n\n## Usage\n\nTo create a new custom admin view:\n\n1. Create a class-based view in `django_custom_admin_pages.views` which inherits from `custom_admin.views.admin_base_view.AdminBaseView`.\n2. Set the view class attribute `view_name` to whatever name you want displayed in the admin index.\n3. Register the view similar to how you would register a ModelAdmin using a custom admin function: `admin.site.register_view(YourView)`.\n4. Use the template `django_custom_admin_pages.templates.base_custom_admin.html` as a sample for how to extend the admin templates so that your view has the admin nav.\n\n\nAlso see `test_proj.test_app.views.example_view.py`\n\n_Example:_\n\n```python\n## in django_custom_admin_pages.views.your_special_view.py\nfrom django.contrib import admin\nfrom django.views.generic import TemplateView\nfrom django_custom_admin_pages.views.admin_base_view import AdminBaseView\n\nclass YourCustomView(AdminBaseView, TemplateView):\n   view_name=\"My Super Special View\"\n   template_name=\"my_template.html\"\n   route_name=\"some-custom-route-name\" # if omitted defaults to snake_case of view_name\n   app_label=\"my_app\" # if omitted defaults to \"django_custom_admin_pages\". Must match app in settings\n\n   # always call super() on get_context_data and use it to start your context dict.\n   # the context required to render admin nav-bar is included here.\n   def get_context_data(self, *args, **kwargs):\n      context:dict = super().get_context_data(*args, **kwargs)\n      # add your context ...\n      return context\n\nadmin.site.register_view(YourCustomView)\n```\n\nYour template should extend `admin/base.html` or `base_custom_admin.html` template:\n```html\n\u003c!-- my_template.html --\u003e\n{% extends 'base_custom_admin.html' with title=\"your page title\" %}\n{% block content %}\n\u003ch1\u003eHello World\u003c/h1\u003e\n{% endblock %}\n```\n\n### Important: Custom Views Must Be Registered Before Admin URLs are Loaded\n\nBe sure to import the files where your views are stored prior to loading your root url conf. For example:\n\n```python\n# project/urls.py\nfrom django.contrib import admin\n\n# importing view before url_patterns ensures it's registered!\nfrom some_app.views import YourCustomView\n\nurl_patterns = [\n   path(\"admin/\", admin.site.urls),\n   ...\n]\n```\n\n## Configurable Settings\n\n- `CUSTOM_ADMIN_DEFAULT_APP_LABEL`: set to override the default app_label (default: `django_custom_admin_pages`)\n\n## Supported Versions\nSee `tox.ini` for list of python / django version which are tested for this project. For example, Python 3.10 is tested for Django 3.2 - 5.2.\n\n## Contributing\n\nReach out to the author if you'd like to contribute! Also free to file bug reports or feature requests via [github issues](https://github.com/lekjos/django-custom-admin-pages/issues).\n\n### Local Development\n\nTo start the test_project:\n- `cd \u003crepo_root\u003e`\n- `poetry install --with dev`\n- `python test_proj/manage.py migrate`\n- `python test_proj/manage.py createsuperuser` (follow prompts)\n- `python test_proj/manage.py runserver`\n- Navigate too `localhost:8000/admin`, log in, and there should be one custom admin view.\n\nTo run the test suite:\n- `poetry run pytest`\n\nPrior to committing:\n1. Run pylint:\n   - `cd \u003crepo_root\u003e`\n   - `poetry run pylint django_custom_admin_pages/`\n\n2. Run black:\n   - `poetry run black .`\n\n2. Run isort:\n   - `poetry run isort django_custom_admin_pages/`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flekjos%2Fdjango-custom-admin-pages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flekjos%2Fdjango-custom-admin-pages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flekjos%2Fdjango-custom-admin-pages/lists"}