new-django 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. new_django-0.1.0/PKG-INFO +6 -0
  2. new_django-0.1.0/pyproject.toml +19 -0
  3. new_django-0.1.0/setup.cfg +4 -0
  4. new_django-0.1.0/src/new_django/__init__.py +0 -0
  5. new_django-0.1.0/src/new_django/cli.py +24 -0
  6. new_django-0.1.0/src/new_django/template/app/__init__.py +0 -0
  7. new_django-0.1.0/src/new_django/template/app/admin.py +15 -0
  8. new_django-0.1.0/src/new_django/template/app/apps.py +5 -0
  9. new_django-0.1.0/src/new_django/template/app/forms.py +62 -0
  10. new_django-0.1.0/src/new_django/template/app/migrations/0001_initial.py +74 -0
  11. new_django-0.1.0/src/new_django/template/app/migrations/__init__.py +0 -0
  12. new_django-0.1.0/src/new_django/template/app/migrations/__pycache__/0001_initial.cpython-313.pyc +0 -0
  13. new_django-0.1.0/src/new_django/template/app/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
  14. new_django-0.1.0/src/new_django/template/app/models.py +59 -0
  15. new_django-0.1.0/src/new_django/template/app/static/app/style.css +204 -0
  16. new_django-0.1.0/src/new_django/template/app/templates/app/application_detail.html +10 -0
  17. new_django-0.1.0/src/new_django/template/app/templates/app/application_form.html +23 -0
  18. new_django-0.1.0/src/new_django/template/app/templates/app/application_list.html +16 -0
  19. new_django-0.1.0/src/new_django/template/app/templates/app/auth_form.html +43 -0
  20. new_django-0.1.0/src/new_django/template/app/templates/app/base.html +28 -0
  21. new_django-0.1.0/src/new_django/template/app/templates/app/dashboard.html +60 -0
  22. new_django-0.1.0/src/new_django/template/app/tests.py +3 -0
  23. new_django-0.1.0/src/new_django/template/app/urls.py +16 -0
  24. new_django-0.1.0/src/new_django/template/app/views.py +109 -0
  25. new_django-0.1.0/src/new_django/template/main/__init__.py +0 -0
  26. new_django-0.1.0/src/new_django/template/main/__pycache__/__init__.cpython-313.pyc +0 -0
  27. new_django-0.1.0/src/new_django/template/main/__pycache__/settings.cpython-313.pyc +0 -0
  28. new_django-0.1.0/src/new_django/template/main/__pycache__/urls.cpython-313.pyc +0 -0
  29. new_django-0.1.0/src/new_django/template/main/__pycache__/wsgi.cpython-313.pyc +0 -0
  30. new_django-0.1.0/src/new_django/template/main/asgi.py +16 -0
  31. new_django-0.1.0/src/new_django/template/main/settings.py +104 -0
  32. new_django-0.1.0/src/new_django/template/main/urls.py +7 -0
  33. new_django-0.1.0/src/new_django/template/main/wsgi.py +16 -0
  34. new_django-0.1.0/src/new_django/template/migrations/0001_initial.py +74 -0
  35. new_django-0.1.0/src/new_django/template/migrations/__init__.py +0 -0
  36. new_django-0.1.0/src/new_django/template/migrations/__pycache__/0001_initial.cpython-313.pyc +0 -0
  37. new_django-0.1.0/src/new_django/template/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
  38. new_django-0.1.0/src/new_django/template/static/app/style.css +204 -0
  39. new_django-0.1.0/src/new_django/template/templates/app/application_detail.html +10 -0
  40. new_django-0.1.0/src/new_django/template/templates/app/application_form.html +23 -0
  41. new_django-0.1.0/src/new_django/template/templates/app/application_list.html +16 -0
  42. new_django-0.1.0/src/new_django/template/templates/app/auth_form.html +43 -0
  43. new_django-0.1.0/src/new_django/template/templates/app/base.html +28 -0
  44. new_django-0.1.0/src/new_django/template/templates/app/dashboard.html +60 -0
  45. new_django-0.1.0/src/new_django.egg-info/PKG-INFO +6 -0
  46. new_django-0.1.0/src/new_django.egg-info/SOURCES.txt +47 -0
  47. new_django-0.1.0/src/new_django.egg-info/dependency_links.txt +1 -0
  48. new_django-0.1.0/src/new_django.egg-info/entry_points.txt +2 -0
  49. new_django-0.1.0/src/new_django.egg-info/top_level.txt +1 -0
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: new-django
3
+ Version: 0.1.0
4
+ Summary: A portable bundle containing a Django project
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "new-django"
7
+ version = "0.1.0"
8
+ description = "A portable bundle containing a Django project"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+
12
+ [project.scripts]
13
+ new-django = "new_django.cli:main"
14
+
15
+ [tool.setuptools.packages.find]
16
+ where = ["src"]
17
+
18
+ [tool.setuptools.package-data]
19
+ new_django = ["template/**/*", "template/**/**/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,24 @@
1
+ import os
2
+ import shutil
3
+ import sys
4
+
5
+ def main():
6
+ # Имя папки, куда распакуется проект (по умолчанию "my_new_django_project")
7
+ target_dir = sys.argv[1] if len(sys.argv) > 1 else "my_new_django_project"
8
+
9
+ current_dir = os.path.dirname(os.path.abspath(__file__))
10
+ template_dir = os.path.join(current_dir, "template")
11
+
12
+ if os.path.exists(target_dir):
13
+ print(f"Ошибка: Папка '{target_dir}' уже существует.")
14
+ return
15
+
16
+ print(f"Распаковка проекта в папку: {target_dir}...")
17
+ try:
18
+ shutil.copytree(template_dir, target_dir)
19
+ print("Готово! 🎉")
20
+ except Exception as e:
21
+ print(f"Ошибка при распаковке: {e}")
22
+
23
+ if __name__ == "__main__":
24
+ main()
@@ -0,0 +1,15 @@
1
+ from django.contrib import admin
2
+ from .models import CustomUser, Category, Application
3
+
4
+ @admin.register(CustomUser)
5
+ class CustomUserAdmin(admin.ModelAdmin):
6
+ list_display = ('username', 'email', 'phone', 'is_staff')
7
+
8
+ @admin.register(Category)
9
+ class CategoryAdmin(admin.ModelAdmin):
10
+ list_display = ('id', 'name')
11
+
12
+ @admin.register(Application)
13
+ class ApplicationAdmin(admin.ModelAdmin):
14
+ list_display = ('id', 'title', 'category', 'status', 'created_by', 'created_at')
15
+ list_filter = ('status', 'category')
@@ -0,0 +1,5 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class AppConfig(AppConfig):
5
+ name = 'app'
@@ -0,0 +1,62 @@
1
+ import re
2
+ from django import forms
3
+ from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
4
+ from django.core.exceptions import ValidationError
5
+ from .models import CustomUser, Application
6
+
7
+
8
+ class RegisterForm(UserCreationForm):
9
+ class Meta:
10
+ model = CustomUser
11
+ fields = ['username', 'email', 'phone', 'password1', 'password2']
12
+ widgets = {
13
+ 'username': forms.TextInput(attrs={'placeholder': 'Придумайте логин'}),
14
+ 'email': forms.EmailInput(attrs={'placeholder': 'example@mail.com'}),
15
+ 'phone': forms.TextInput(attrs={'placeholder': '+7 (999) 123-45-67'}),
16
+ }
17
+
18
+ def __init__(self, *args, **kwargs):
19
+ super().__init__(*args, **kwargs)
20
+ # Добавляем подсказки для паролей
21
+ self.fields['password1'].widget.attrs.update({'placeholder': 'Минимум 8 символов'})
22
+ self.fields['password2'].widget.attrs.update({'placeholder': 'Повторите пароль'})
23
+
24
+ # Убираем стандартные длинные тексты ошибок Django, делаем их короче
25
+ self.fields['password1'].help_text = 'Пароль должен содержать минимум 8 символов и не быть слишком простым.'
26
+ self.fields['username'].help_text = 'Обязательное поле. Не более 150 символов.'
27
+
28
+ # --- ВАЛИДАЦИЯ ТЕЛЕФОНА ---
29
+ def clean_phone(self):
30
+ phone = self.cleaned_data.get('phone')
31
+ # Если поле пустое, пропускаем (так как в модели blank=True)
32
+ if not phone:
33
+ return phone
34
+
35
+ # Регулярное выражение: допускает +7, 8, пробелы, скобки и дефисы
36
+ # Примеры валидных номеров: +7 (999) 123-45-67, 89991234567, +79991234567
37
+ pattern = r'^(\+7|8)?[\s\-\(\)]*\d{3}[\s\-\(\)]*\d{3}[\s\-]*\d{2}[\s\-]*\d{2}$'
38
+
39
+ # Убираем все лишние символы для точной проверки количества цифр
40
+ digits_only = re.sub(r'\D', '', phone)
41
+
42
+ if not re.match(pattern, phone) or len(digits_only) != 11:
43
+ raise ValidationError('Введите корректный номер телефона (11 цифр, например: +7 999 123-45-67)')
44
+
45
+ return phone
46
+
47
+
48
+ class LoginForm(AuthenticationForm):
49
+ def __init__(self, *args, **kwargs):
50
+ super().__init__(*args, **kwargs)
51
+ self.fields['username'].widget.attrs.update({'placeholder': 'Ваш логин'})
52
+ self.fields['password'].widget.attrs.update({'placeholder': 'Ваш пароль'})
53
+
54
+
55
+ class ApplicationForm(forms.ModelForm):
56
+ class Meta:
57
+ model = Application
58
+ fields = ['title', 'content', 'category']
59
+ widgets = {
60
+ 'title': forms.TextInput(attrs={'placeholder': 'Кратко опишите суть'}),
61
+ 'content': forms.Textarea(attrs={'rows': 5, 'placeholder': 'Подробное описание заявки'}),
62
+ }
@@ -0,0 +1,74 @@
1
+ # Generated by Django 6.1.3 on 2026-11-21 11:05
2
+
3
+ import django.contrib.auth.models
4
+ import django.contrib.auth.validators
5
+ import django.db.models.deletion
6
+ import django.utils.timezone
7
+ from django.conf import settings
8
+ from django.db import migrations, models
9
+
10
+
11
+ class Migration(migrations.Migration):
12
+
13
+ initial = True
14
+
15
+ dependencies = [
16
+ ('auth', '0012_alter_user_first_name_max_length'),
17
+ ]
18
+
19
+ operations = [
20
+ migrations.CreateModel(
21
+ name='Category',
22
+ fields=[
23
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
24
+ ('name', models.CharField(max_length=50, verbose_name='Название')),
25
+ ],
26
+ options={
27
+ 'verbose_name': 'Категория',
28
+ 'verbose_name_plural': 'Категории',
29
+ },
30
+ ),
31
+ migrations.CreateModel(
32
+ name='CustomUser',
33
+ fields=[
34
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
35
+ ('password', models.CharField(max_length=128, verbose_name='password')),
36
+ ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
37
+ ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
38
+ ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
39
+ ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
40
+ ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
41
+ ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
42
+ ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
43
+ ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
44
+ ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
45
+ ('phone', models.CharField(blank=True, max_length=20, verbose_name='Телефон')),
46
+ ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
47
+ ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
48
+ ],
49
+ options={
50
+ 'verbose_name': 'Пользователь',
51
+ 'verbose_name_plural': 'Пользователи',
52
+ },
53
+ managers=[
54
+ ('objects', django.contrib.auth.models.UserManager()),
55
+ ],
56
+ ),
57
+ migrations.CreateModel(
58
+ name='Application',
59
+ fields=[
60
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
61
+ ('title', models.CharField(max_length=200, verbose_name='Заголовок')),
62
+ ('content', models.TextField(verbose_name='Содержание')),
63
+ ('status', models.CharField(choices=[('pending', 'На рассмотрении'), ('approved', 'Одобрено'), ('rejected', 'Отклонено')], default='pending', max_length=10, verbose_name='Статус')),
64
+ ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
65
+ ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Автор')),
66
+ ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='app.category', verbose_name='Категория')),
67
+ ],
68
+ options={
69
+ 'verbose_name': 'Заявка',
70
+ 'verbose_name_plural': 'Заявки',
71
+ 'ordering': ['-created_at'],
72
+ },
73
+ ),
74
+ ]
@@ -0,0 +1,59 @@
1
+ from django.contrib.auth.models import AbstractUser
2
+ from django.db import models
3
+
4
+
5
+ class CustomUser(AbstractUser):
6
+ phone = models.CharField(max_length=20, blank=True, verbose_name='Телефон')
7
+
8
+ class Meta:
9
+ verbose_name = 'Пользователь'
10
+ verbose_name_plural = 'Пользователи'
11
+
12
+
13
+ class Category(models.Model):
14
+ name = models.CharField(max_length=50, verbose_name='Название')
15
+
16
+ class Meta:
17
+ verbose_name = 'Категория'
18
+ verbose_name_plural = 'Категории'
19
+
20
+ def __str__(self):
21
+ return self.name
22
+
23
+
24
+ class Application(models.Model):
25
+ STATUS_CHOICES = [
26
+ ('pending', 'На рассмотрении'),
27
+ ('approved', 'Одобрено'),
28
+ ('rejected', 'Отклонено'),
29
+ ]
30
+
31
+ title = models.CharField(max_length=200, verbose_name='Заголовок')
32
+ content = models.TextField(verbose_name='Содержание')
33
+ status = models.CharField(
34
+ max_length=10,
35
+ choices=STATUS_CHOICES,
36
+ default='pending',
37
+ verbose_name='Статус'
38
+ )
39
+ category = models.ForeignKey(
40
+ Category,
41
+ on_delete=models.SET_NULL,
42
+ null=True,
43
+ blank=True,
44
+ verbose_name='Категория'
45
+ )
46
+ created_by = models.ForeignKey(
47
+ CustomUser,
48
+ on_delete=models.CASCADE,
49
+ verbose_name='Автор'
50
+ )
51
+ created_at = models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')
52
+
53
+ class Meta:
54
+ verbose_name = 'Заявка'
55
+ verbose_name_plural = 'Заявки'
56
+ ordering = ['-created_at']
57
+
58
+ def __str__(self):
59
+ return self.title
@@ -0,0 +1,204 @@
1
+ /* --- Базовые настройки --- */
2
+ body {
3
+ font-family: Arial, sans-serif;
4
+ margin: 0;
5
+ padding: 0;
6
+ background-color: #fafafa;
7
+ color: #333;
8
+ }
9
+
10
+ /* --- Контейнер по центру --- */
11
+ .container {
12
+ max-width: 900px;
13
+ margin: 0 auto;
14
+ padding: 20px;
15
+ }
16
+
17
+ /* --- Навигация (простая линия) --- */
18
+ nav {
19
+ padding: 15px 0;
20
+ border-bottom: 1px solid #ccc;
21
+ margin-bottom: 30px;
22
+ display: flex;
23
+ gap: 15px;
24
+ }
25
+
26
+ nav a {
27
+ text-decoration: none;
28
+ color: #0056b3;
29
+ }
30
+
31
+ nav a:hover {
32
+ text-decoration: underline;
33
+ }
34
+
35
+ nav .logout-link {
36
+ margin-left: auto;
37
+ color: #c82333;
38
+ }
39
+
40
+ /* --- Контент --- */
41
+ h2 {
42
+ margin-bottom: 20px;
43
+ font-size: 24px;
44
+ }
45
+
46
+ /* --- Таблица (строгая, классическая) --- */
47
+ table {
48
+ width: 100%;
49
+ border-collapse: collapse;
50
+ }
51
+
52
+ th, td {
53
+ padding: 10px;
54
+ border: 1px solid #ddd;
55
+ text-align: left;
56
+ }
57
+
58
+ th {
59
+ background-color: #f4f4f4;
60
+ }
61
+
62
+ tr:nth-child(even) {
63
+ background-color: #f9f9f9;
64
+ }
65
+
66
+ /* Кнопки в таблице */
67
+ td a {
68
+ display: inline-block;
69
+ padding: 4px 8px;
70
+ text-decoration: none;
71
+ border-radius: 3px;
72
+ font-size: 13px;
73
+ border: 1px solid transparent;
74
+ }
75
+ td a[href*="approved"] {
76
+ color: #218838;
77
+ border-color: #218838;
78
+ }
79
+ td a[href*="rejected"] {
80
+ color: #c82333;
81
+ border-color: #c82333;
82
+ }
83
+ td a:hover {
84
+ background-color: #eee;
85
+ }
86
+
87
+
88
+ /* --- Кнопки формы --- */
89
+ button {
90
+ padding: 8px 16px;
91
+ background-color: #0056b3;
92
+ color: white;
93
+ border: none;
94
+ border-radius: 3px;
95
+ cursor: pointer;
96
+ }
97
+ button:hover {
98
+ background-color: #004494;
99
+ }
100
+
101
+ /* --- Формы входа/регистрации (просто по центру) --- */
102
+ .auth-container {
103
+ display: flex;
104
+ justify-content: center;
105
+ margin-top: 40px;
106
+ }
107
+
108
+ .auth-card {
109
+ width: 100%;
110
+ max-width: 400px;
111
+ }
112
+
113
+ .form-group {
114
+ margin-bottom: 15px;
115
+ }
116
+
117
+ .form-group label {
118
+ display: block;
119
+ margin-bottom: 5px;
120
+ font-weight: bold;
121
+ }
122
+
123
+ .form-group input {
124
+ width: 100%;
125
+ padding: 8px;
126
+ border: 1px solid #ccc;
127
+ border-radius: 3px;
128
+ box-sizing: border-box;
129
+ }
130
+
131
+ /* Ошибки в формах */
132
+ .field-error {
133
+ color: #c82333;
134
+ font-size: 13px;
135
+ margin-top: 4px;
136
+ }
137
+
138
+ .error-box {
139
+ color: #c82333;
140
+ margin-bottom: 10px;
141
+ }
142
+
143
+ .help-text {
144
+ font-size: 12px;
145
+ color: #666;
146
+ margin-top: 4px;
147
+ }
148
+ /* --- Дополнительные стили для админ-панели --- */
149
+ .section-title {
150
+ margin-top: 20px;
151
+ }
152
+
153
+ .divider {
154
+ margin: 40px 0;
155
+ border: none;
156
+ border-top: 1px solid #ccc;
157
+ }
158
+
159
+ .category-manager {
160
+ display: flex;
161
+ gap: 40px;
162
+ margin-top: 15px;
163
+ }
164
+
165
+ .category-block {
166
+ flex: 1;
167
+ }
168
+
169
+ .category-block h4 {
170
+ margin-bottom: 10px;
171
+ font-size: 16px;
172
+ }
173
+
174
+ .inline-form {
175
+ display: flex;
176
+ gap: 10px;
177
+ }
178
+
179
+ .inline-form input {
180
+ padding: 8px;
181
+ border: 1px solid #ccc;
182
+ border-radius: 3px;
183
+ flex: 1; /* Поле ввода займет доступное место */
184
+ }
185
+
186
+ .category-list {
187
+ padding-left: 20px;
188
+ margin-top: 10px;
189
+ }
190
+
191
+ .category-list li {
192
+ margin-bottom: 6px;
193
+ }
194
+
195
+ .delete-link {
196
+ color: #c82333;
197
+ font-size: 13px;
198
+ margin-left: 10px;
199
+ text-decoration: none;
200
+ }
201
+
202
+ .delete-link:hover {
203
+ text-decoration: underline;
204
+ }
@@ -0,0 +1,10 @@
1
+ {% extends 'app/base.html' %}
2
+ {% block content %}
3
+ <h2>{{ application.title }}</h2>
4
+ <p><strong>Статус:</strong> {{ application.get_status_display }}</p>
5
+ <p><strong>Категория:</strong> {{ application.category }}</p>
6
+ <p><strong>Автор:</strong> {{ application.created_by.username }}</p>
7
+ <p><strong>Дата:</strong> {{ application.created_at }}</p>
8
+ <p>{{ application.content }}</p>
9
+ <a href="{% url 'application_list' %}">← Назад</a>
10
+ {% endblock %}
@@ -0,0 +1,23 @@
1
+ {% extends 'app/base.html' %}
2
+ {% block content %}
3
+ <div class="auth-container">
4
+ <div class="auth-card" style="max-width: 600px;">
5
+ <h2>Создание заявки</h2>
6
+ <form method="post">
7
+ {% csrf_token %}
8
+
9
+ {% for field in form %}
10
+ <div class="form-group">
11
+ <label for="{{ field.id_for_label }}">{{ field.label }}</label>
12
+ {{ field }}
13
+ {% if field.errors %}
14
+ <div class="field-error">{{ field.errors.0 }}</div>
15
+ {% endif %}
16
+ </div>
17
+ {% endfor %}
18
+
19
+ <button type="submit" style="width: 100%;">Отправить</button>
20
+ </form>
21
+ </div>
22
+ </div>
23
+ {% endblock %}
@@ -0,0 +1,16 @@
1
+ {% extends 'app/base.html' %}
2
+ {% block content %}
3
+ <h2>Список заявок</h2>
4
+ <a href="{% url 'application_create' %}">+ Создать заявку</a>
5
+ <ul>
6
+ {% for app in applications %}
7
+ <li>
8
+ <a href="{% url 'application_detail' app.pk %}">{{ app.title }}</a>
9
+ — {{ app.get_status_display }}
10
+ ({{ app.created_by.username }})
11
+ </li>
12
+ {% empty %}
13
+ <li>Заявок пока нет</li>
14
+ {% endfor %}
15
+ </ul>
16
+ {% endblock %}
@@ -0,0 +1,43 @@
1
+ {% extends 'app/base.html' %}
2
+ {% block content %}
3
+ <div class="auth-container">
4
+ <div class="auth-card">
5
+ <h2>{{ title }}</h2>
6
+
7
+ <form method="post">
8
+ {% csrf_token %}
9
+
10
+ {# Выводим общие ошибки формы (если пароли не совпали) #}
11
+ {% if form.non_field_errors %}
12
+ <div class="error-box">
13
+ {{ form.non_field_errors }}
14
+ </div>
15
+ {% endif %}
16
+
17
+ {# Проходимся циклом по всем полям #}
18
+ {% for field in form %}
19
+ <div class="form-group">
20
+ <label for="{{ field.id_for_label }}">{{ field.label }}</label>
21
+ {{ field }}
22
+
23
+ {# Вывод ошибок конкретного поля #}
24
+ {% if field.errors %}
25
+ <div class="field-error">
26
+ {{ field.errors.0 }}
27
+ </div>
28
+ {% endif %}
29
+
30
+ {# Вывод подсказок (help_text) #}
31
+ {% if field.help_text %}
32
+ <div class="help-text">
33
+ {{ field.help_text|safe }}
34
+ </div>
35
+ {% endif %}
36
+ </div>
37
+ {% endfor %}
38
+
39
+ <button type="submit" class="btn-primary">{{ button }}</button>
40
+ </form>
41
+ </div>
42
+ </div>
43
+ {% endblock %}
@@ -0,0 +1,28 @@
1
+ {% load static %}
2
+ <!DOCTYPE html>
3
+ <html lang="ru">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title>Система заявок</title>
7
+ <link rel="stylesheet" href="{% static 'app/style.css' %}">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <nav>
12
+ {% if user.is_authenticated %}
13
+ <a href="{% url 'application_list' %}">Заявки</a>
14
+ <a href="{% url 'application_create' %}">Создать заявку</a>
15
+ {% if user.is_staff %}<a href="{% url 'dashboard' %}">Админ-панель</a>{% endif %}
16
+ <a href="{% url 'logout' %}" class="logout-link">Выйти ({{ user.username }})</a>
17
+ {% else %}
18
+ <a href="{% url 'login' %}">Вход</a>
19
+ <a href="{% url 'register' %}">Регистрация</a>
20
+ {% endif %}
21
+ </nav>
22
+
23
+ <main class="content">
24
+ {% block content %}{% endblock %}
25
+ </main>
26
+ </div>
27
+ </body>
28
+ </html>