Добавлен модуль system_settings с навигацией через вкладки и исправлена маршрутизация user_roles
This commit is contained in:
0
myproject/system_settings/__init__.py
Normal file
0
myproject/system_settings/__init__.py
Normal file
3
myproject/system_settings/admin.py
Normal file
3
myproject/system_settings/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
7
myproject/system_settings/apps.py
Normal file
7
myproject/system_settings/apps.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class SystemSettingsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'system_settings'
|
||||
verbose_name = 'Системные настройки'
|
||||
0
myproject/system_settings/migrations/__init__.py
Normal file
0
myproject/system_settings/migrations/__init__.py
Normal file
3
myproject/system_settings/models.py
Normal file
3
myproject/system_settings/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
@@ -0,0 +1,29 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container py-4">
|
||||
<!-- Заголовок -->
|
||||
<h2 class="mb-4">⚙️ Настройки</h2>
|
||||
|
||||
<!-- Навигация через вкладки -->
|
||||
<ul class="nav nav-tabs mb-4" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link {% if request.resolver_match.url_name == 'settings' %}active{% endif %}"
|
||||
href="{% url 'system_settings:settings' %}">
|
||||
Системные настройки
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link {% if 'user_roles' in request.resolver_match.namespaces %}active{% endif %}"
|
||||
href="{% url 'system_settings:user_roles:list' %}">
|
||||
Роли пользователей
|
||||
</a>
|
||||
</li>
|
||||
<!-- Здесь в будущем добавятся: Категории, Статусы заказов, Часовой пояс, Интеграции и т.д. -->
|
||||
</ul>
|
||||
|
||||
<!-- Контент конкретной страницы настроек -->
|
||||
{% block settings_content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,18 @@
|
||||
{% extends "system_settings/base_settings.html" %}
|
||||
|
||||
{% block title %}Системные настройки{% endblock %}
|
||||
|
||||
{% block settings_content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-lg-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body p-4">
|
||||
<p class="text-muted mb-0">
|
||||
Здесь в будущем вы сможете настраивать категории, статусы заказов,
|
||||
часовой пояс, интеграции и другие параметры вашей компании.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
3
myproject/system_settings/tests.py
Normal file
3
myproject/system_settings/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
10
myproject/system_settings/urls.py
Normal file
10
myproject/system_settings/urls.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from django.urls import path, include
|
||||
|
||||
from .views import SystemSettingsView
|
||||
|
||||
app_name = "system_settings"
|
||||
|
||||
urlpatterns = [
|
||||
path("", SystemSettingsView.as_view(), name="settings"),
|
||||
path("roles/", include('user_roles.urls', namespace='user_roles')),
|
||||
]
|
||||
8
myproject/system_settings/views.py
Normal file
8
myproject/system_settings/views.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from user_roles.mixins import OwnerRequiredMixin
|
||||
|
||||
|
||||
class SystemSettingsView(OwnerRequiredMixin, TemplateView):
|
||||
"""Главная страница настроек (доступна только владельцу)"""
|
||||
template_name = "system_settings/settings.html"
|
||||
Reference in New Issue
Block a user