Features: 1) Add new admin menu items for Config, Users, Groups, Products, Categories, Brands, Blogposts, Periodic Tasks, and Sitemap; 2) Integrate Unfold's constance additional fields into CONSTANCE_ADDITIONAL_FIELDS;

Fixes: 1) Reorder INSTALLED_APPS to place "constance" after "unfold.contrib.constance";

Extra: 1) Update SVG icon for health check; 2) Add missing import for UNFOLD_CONSTANCE_ADDITIONAL_FIELDS; 3) Fix indentation in constance.py.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-11-15 03:57:13 +03:00
parent e9ccbace94
commit 9f46252f48
6 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="#e10098"><style>svg{fill:color(display-p3 0.8824 0 0.5961);}</style><path fill-rule="evenodd" clip-rule="evenodd" d="M50 6.90308L87.323 28.4515V71.5484L50 93.0968L12.677 71.5484V28.4515L50 6.90308ZM16.8647 30.8693V62.5251L44.2795 15.0414L16.8647 30.8693ZM50 13.5086L18.3975 68.2457H81.6025L50 13.5086ZM77.4148 72.4334H22.5852L50 88.2613L77.4148 72.4334ZM83.1353 62.5251L55.7205 15.0414L83.1353 30.8693V62.5251Z"/><circle cx="50" cy="9.3209" r="8.82"/><circle cx="85.2292" cy="29.6605" r="8.82"/><circle cx="85.2292" cy="70.3396" r="8.82"/><circle cx="50" cy="90.6791" r="8.82"/><circle cx="14.7659" cy="70.3396" r="8.82"/><circle cx="14.7659" cy="29.6605" r="8.82"/></svg>

After

Width:  |  Height:  |  Size: 740 B

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64">
<path d="M0 0 C4.85630418 -0.09938127 9.71200765 -0.17170794 14.5690918 -0.21972656 C16.21893637 -0.23975797 17.8687107 -0.26699142 19.51831055 -0.30175781 C21.89910274 -0.35065357 24.278951 -0.3730528 26.66015625 -0.390625 C27.38960953 -0.41127014 28.11906281 -0.43191528 28.87062073 -0.45318604 C34.98996246 -0.45582643 39.16046149 1.39602858 43.7421875 5.59765625 C48.39070216 11.60866658 48.56284028 16.60873893 48 24 C46.25230248 29.44870404 42.60721838 32.78541808 38 36 C34.30459598 37.23180134 30.89696622 37.12412112 27.05078125 37.09765625 C26.27816452 37.0962413 25.50554779 37.09482635 24.70951843 37.09336853 C22.24380611 37.08777466 19.77818485 37.07522333 17.3125 37.0625 C15.63997527 37.05748421 13.96744912 37.05292144 12.29492188 37.04882812 C8.19657954 37.03780724 4.09830521 37.02054684 0 37 C0.33 36.01 0.66 35.02 1 34 C2.97285682 33.30950011 4.94642158 32.62085067 6.92578125 31.94921875 C10.37674801 30.36996277 11.86671615 28.10295833 14 25 C15.56840852 20.29477445 15.54895539 16.47351184 13.8125 11.8125 C10.19941703 6.20599194 6.23939638 4.46809327 0 3 C0 2.01 0 1.02 0 0 Z " fill="#ffffff" transform="translate(8,1)"/>
<path d="M0 0 C4.69557647 -0.09954745 9.39052663 -0.17178467 14.08691406 -0.21972656 C15.68142408 -0.23973053 17.27586178 -0.26694301 18.87011719 -0.30175781 C36.87926136 -0.68493109 36.87926136 -0.68493109 44.9375 6.6875 C47 10 47 10 48 19 C37.44 19 26.88 19 16 19 C15.01 16.03 14.02 13.06 13 10 C9.007668 5.73546355 5.53762935 4.21827846 0 3 C0 2.01 0 1.02 0 0 Z " fill="#ffffff" transform="translate(8,44)"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><title>file_type_swagger</title><path d="M30,16a14,14,0,1,1-4.1-9.9A13.956,13.956,0,0,1,30,16Z" style="fill:#fff"/><path d="M27.9,16a11.9,11.9,0,1,1-3.485-8.415A11.863,11.863,0,0,1,27.9,16Z" style="fill:#6d9a00"/><path d="M11.66,15.983a.938.938,0,0,1,.977-.976.976.976,0,1,1-.977.976Z" style="fill:#fff"/><path d="M15.031,15.983a.938.938,0,0,1,.977-.976.976.976,0,1,1-.977.976Z" style="fill:#fff"/><path d="M18.4,15.983a.938.938,0,0,1,.977-.976.976.976,0,1,1-.977.976Z" style="fill:#fff"/><path d="M7.619,16.89V15.142A2.824,2.824,0,0,0,8.5,15a1.126,1.126,0,0,0,.439-.441,2.1,2.1,0,0,0,.254-.776,9.08,9.08,0,0,0,.055-1.216,10.547,10.547,0,0,1,.123-1.97,1.847,1.847,0,0,1,.446-.9,1.72,1.72,0,0,1,.81-.552,4.788,4.788,0,0,1,1.316-.131h.363v1.437a3.177,3.177,0,0,0-.977.091.63.63,0,0,0-.319.277,3.372,3.372,0,0,0-.1.941q0,.459-.062,1.741a4.639,4.639,0,0,1-.178,1.169,2.435,2.435,0,0,1-.367.739,2.939,2.939,0,0,1-.682.6,2.432,2.432,0,0,1,.662.579,2.377,2.377,0,0,1,.394.8,5.8,5.8,0,0,1,.178,1.267q.048,1.209.048,1.544a3.034,3.034,0,0,0,.11.932.694.694,0,0,0,.333.288,2.927,2.927,0,0,0,.963.1v1.486h-.363a3.843,3.843,0,0,1-1.292-.192A1.905,1.905,0,0,1,9.82,22.3a1.875,1.875,0,0,1-.456-.9,8.724,8.724,0,0,1-.117-1.686,8.414,8.414,0,0,0-.11-1.741,1.553,1.553,0,0,0-.456-.834A2.106,2.106,0,0,0,7.619,16.89Z" style="fill:#fff"/><path d="M23.285,17.143a1.553,1.553,0,0,0-.456.834,8.414,8.414,0,0,0-.11,1.741A8.724,8.724,0,0,1,22.6,21.4a1.875,1.875,0,0,1-.456.9,1.905,1.905,0,0,1-.833.521,3.843,3.843,0,0,1-1.292.192h-.363V21.53a2.927,2.927,0,0,0,.963-.1.694.694,0,0,0,.333-.288,3.034,3.034,0,0,0,.11-.932q0-.335.048-1.544A5.8,5.8,0,0,1,21.29,17.4a2.377,2.377,0,0,1,.394-.8,2.432,2.432,0,0,1,.662-.579,2.939,2.939,0,0,1-.682-.6,2.435,2.435,0,0,1-.367-.739,4.639,4.639,0,0,1-.178-1.169q-.062-1.282-.062-1.741a3.372,3.372,0,0,0-.1-.941.63.63,0,0,0-.319-.277,3.177,3.177,0,0,0-.977-.091V9.016h.363a4.788,4.788,0,0,1,1.316.131,1.72,1.72,0,0,1,.81.552,1.847,1.847,0,0,1,.446.9,10.547,10.547,0,0,1,.123,1.97,9.08,9.08,0,0,0,.055,1.216,2.1,2.1,0,0,0,.254.776,1.126,1.126,0,0,0,.439.441,2.824,2.824,0,0,0,.883.144V16.89A2.106,2.106,0,0,0,23.285,17.143Z" style="fill:#fff"/></svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -108,13 +108,13 @@ SITE_ID: int = 1
INSTALLED_APPS: list[str] = [ INSTALLED_APPS: list[str] = [
"django_prometheus", "django_prometheus",
"constance",
"unfold", "unfold",
"unfold.contrib.filters", "unfold.contrib.filters",
"unfold.contrib.forms", "unfold.contrib.forms",
"unfold.contrib.inlines", "unfold.contrib.inlines",
"unfold.contrib.constance", "unfold.contrib.constance",
"unfold.contrib.import_export", "unfold.contrib.import_export",
"constance",
"modeltranslation", "modeltranslation",
"django.contrib.admin", "django.contrib.admin",
"django.contrib.admindocs", "django.contrib.admindocs",

View file

@ -2,11 +2,13 @@ from collections import OrderedDict
from os import getenv from os import getenv
from django.utils.translation import gettext_noop as _ from django.utils.translation import gettext_noop as _
from unfold.contrib.constance.settings import UNFOLD_CONSTANCE_ADDITIONAL_FIELDS
CONSTANCE_BACKEND = "constance.backends.database.DatabaseBackend" CONSTANCE_BACKEND = "constance.backends.database.DatabaseBackend"
CONSTANCE_SUPERUSER_ONLY = False CONSTANCE_SUPERUSER_ONLY = False
CONSTANCE_ADDITIONAL_FIELDS = { CONSTANCE_ADDITIONAL_FIELDS = {
**UNFOLD_CONSTANCE_ADDITIONAL_FIELDS,
"json": [ "json": [
"django.forms.fields.JSONField", "django.forms.fields.JSONField",
{ {

View file

@ -73,6 +73,51 @@ UNFOLD = {
"icon": "health_metrics", "icon": "health_metrics",
"link": reverse_lazy("health_check:health_check_home"), "link": reverse_lazy("health_check:health_check_home"),
}, },
{
"title": _("Config"),
"icon": "construction",
"link": reverse_lazy("admin:core_config_changelist"),
},
{
"title": _("Users"),
"icon": "person",
"link": reverse_lazy("admin:vibes_auth_user_changelist"),
},
{
"title": _("Groups"),
"icon": "people",
"link": reverse_lazy("admin:vibes_auth_group_changelist"),
},
{
"title": _("Products"),
"icon": "storefront",
"link": reverse_lazy("admin:core_product_changelist"),
},
{
"title": _("Categories"),
"icon": "category",
"link": reverse_lazy("admin:core_category_changelist"),
},
{
"title": _("Brands"),
"icon": "copyright",
"link": reverse_lazy("admin:core_brand_changelist"),
},
{
"title": _("Blogposts"),
"icon": "newspaper",
"link": reverse_lazy("admin:blog_post_changelist"),
},
{
"title": _("Periodic Tasks"),
"icon": "event_list",
"link": reverse_lazy("admin:django_celery_beat_periodictask_changelist"),
},
{
"title": _("Sitemap"),
"icon": "rss_feed",
"link": reverse_lazy("core:sitemap-index"),
},
{ {
"title": _("Swagger"), "title": _("Swagger"),
"icon": "integration_instructions", "icon": "integration_instructions",