Fixes: 1) None. Extra: 1) Refactored language flag definitions into a centralized dictionary in base settings; 2) Added commerce utility functions for revenue, returns, and order processing; 3) Improved code structure and documentation in views and utils.
141 lines
4.9 KiB
Python
141 lines
4.9 KiB
Python
from django.templatetags.static import static
|
|
from django.urls import reverse_lazy
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from evibes.settings.base import (
|
|
PROJECT_NAME,
|
|
STOREFRONT_DOMAIN,
|
|
SUPPORT_CONTACT,
|
|
TASKBOARD_URL,
|
|
LANGUAGES as BASE_LANGUAGES,
|
|
LANGUAGES_FLAGS,
|
|
)
|
|
|
|
UNFOLD = {
|
|
"SITE_URL": STOREFRONT_DOMAIN,
|
|
"SITE_TITLE": f"{PROJECT_NAME} Dashboard",
|
|
"SITE_HEADER": PROJECT_NAME,
|
|
"SITE_LOGO": "favicon.png",
|
|
"SITE_ICON": "favicon.ico",
|
|
"SITE_SYMBOL": "money",
|
|
"SHOW_LANGUAGES": True,
|
|
"SHOW_VIEW_ON_SITE": False,
|
|
"LOGIN": {
|
|
"image": lambda request: static("favicon.png"),
|
|
},
|
|
"COMMAND": {
|
|
"search_models": True,
|
|
"show_history": True,
|
|
},
|
|
"DASHBOARD_CALLBACK": "core.views.dashboard_callback",
|
|
"LANGUAGES": {
|
|
"navigation": [
|
|
{
|
|
"bidi": code.split("-")[0] in {"ar", "he", "fa", "ur"},
|
|
"code": code,
|
|
"name": LANGUAGES_FLAGS.get(code),
|
|
"name_local": name,
|
|
"name_translated": _(name),
|
|
}
|
|
for code, name in BASE_LANGUAGES
|
|
],
|
|
},
|
|
"EXTENSIONS": {
|
|
"modeltranslation": {
|
|
"flags": LANGUAGES_FLAGS,
|
|
},
|
|
},
|
|
"SIDEBAR": {
|
|
"show_search": True,
|
|
"show_all_applications": True,
|
|
"navigation": [
|
|
{
|
|
"title": _("Menu"),
|
|
"separator": True,
|
|
"collapsible": False,
|
|
"items": [
|
|
{
|
|
"title": _("Dashboard"),
|
|
"icon": "dashboard",
|
|
"link": reverse_lazy("admin:index"),
|
|
},
|
|
{
|
|
"title": _("Health"),
|
|
"icon": "health_metrics",
|
|
"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",
|
|
"icon": "integration_instructions",
|
|
"link": reverse_lazy("swagger-ui-platform"),
|
|
},
|
|
{
|
|
"title": "Redoc",
|
|
"icon": "integration_instructions",
|
|
"link": reverse_lazy("redoc-ui-platform"),
|
|
},
|
|
{
|
|
"title": "GraphQL",
|
|
"icon": "graph_5",
|
|
"link": reverse_lazy("graphql-platform"),
|
|
},
|
|
{
|
|
"title": _("Taskboard"),
|
|
"icon": "view_kanban",
|
|
"link": TASKBOARD_URL,
|
|
},
|
|
{
|
|
"title": _("Support"),
|
|
"icon": "contact_support",
|
|
"link": SUPPORT_CONTACT,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
}
|