style-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.
- style_django-0.1.0/PKG-INFO +6 -0
- style_django-0.1.0/pyproject.toml +19 -0
- style_django-0.1.0/setup.cfg +4 -0
- style_django-0.1.0/src/style_django/__init__.py +1 -0
- style_django-0.1.0/src/style_django/cli.py +31 -0
- style_django-0.1.0/src/style_django/template/applications/__init__.py +0 -0
- style_django-0.1.0/src/style_django/template/applications/__pycache__/__init__.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/__pycache__/admin.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/__pycache__/apps.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/__pycache__/forms.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/__pycache__/models.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/__pycache__/urls.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/__pycache__/views.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/admin.py +23 -0
- style_django-0.1.0/src/style_django/template/applications/apps.py +5 -0
- style_django-0.1.0/src/style_django/template/applications/forms.py +99 -0
- style_django-0.1.0/src/style_django/template/applications/migrations/0001_initial.py +60 -0
- style_django-0.1.0/src/style_django/template/applications/migrations/0002_alter_application_start_date.py +18 -0
- style_django-0.1.0/src/style_django/template/applications/migrations/__init__.py +0 -0
- style_django-0.1.0/src/style_django/template/applications/migrations/__pycache__/0001_initial.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/migrations/__pycache__/0002_alter_application_start_date.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/migrations/__pycache__/__init__.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/applications/models.py +63 -0
- style_django-0.1.0/src/style_django/template/applications/static/applications/style.css +103 -0
- style_django-0.1.0/src/style_django/template/applications/templates/applications/admin_panel.html +47 -0
- style_django-0.1.0/src/style_django/template/applications/templates/applications/application_form.html +43 -0
- style_django-0.1.0/src/style_django/template/applications/templates/applications/base.html +15 -0
- style_django-0.1.0/src/style_django/template/applications/templates/applications/login.html +34 -0
- style_django-0.1.0/src/style_django/template/applications/templates/applications/my_applications.html +51 -0
- style_django-0.1.0/src/style_django/template/applications/templates/applications/register.html +58 -0
- style_django-0.1.0/src/style_django/template/applications/tests.py +3 -0
- style_django-0.1.0/src/style_django/template/applications/urls.py +14 -0
- style_django-0.1.0/src/style_django/template/applications/views.py +96 -0
- style_django-0.1.0/src/style_django/template/config/__init__.py +0 -0
- style_django-0.1.0/src/style_django/template/config/__pycache__/__init__.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/config/__pycache__/settings.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/config/__pycache__/urls.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/config/__pycache__/wsgi.cpython-313.pyc +0 -0
- style_django-0.1.0/src/style_django/template/config/asgi.py +16 -0
- style_django-0.1.0/src/style_django/template/config/settings.py +138 -0
- style_django-0.1.0/src/style_django/template/config/urls.py +27 -0
- style_django-0.1.0/src/style_django/template/config/wsgi.py +16 -0
- style_django-0.1.0/src/style_django/template/manage.py +22 -0
- style_django-0.1.0/src/style_django.egg-info/PKG-INFO +6 -0
- style_django-0.1.0/src/style_django.egg-info/SOURCES.txt +46 -0
- style_django-0.1.0/src/style_django.egg-info/dependency_links.txt +1 -0
- style_django-0.1.0/src/style_django.egg-info/entry_points.txt +2 -0
- style_django-0.1.0/src/style_django.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "style-django"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Portable Django project bundle"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
|
|
12
|
+
[project.scripts]
|
|
13
|
+
unpack-style-django = "style_django.cli:main"
|
|
14
|
+
|
|
15
|
+
[tool.setuptools.packages.find]
|
|
16
|
+
where = ["src"]
|
|
17
|
+
|
|
18
|
+
[tool.setuptools.package-data]
|
|
19
|
+
style_django = ["template/**/*"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from importlib.resources import files, as_file
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
if len(sys.argv) > 1:
|
|
8
|
+
target_dir = Path(sys.argv[1])
|
|
9
|
+
else:
|
|
10
|
+
|
|
11
|
+
target_dir = Path.cwd() / "style-django-project"
|
|
12
|
+
|
|
13
|
+
target_dir.mkdir(parents=True, exist_ok=True)
|
|
14
|
+
|
|
15
|
+
resource = files("style_django") / "template"
|
|
16
|
+
|
|
17
|
+
with as_file(resource) as src_path:
|
|
18
|
+
if not src_path.is_dir():
|
|
19
|
+
print("Ошибка: в пакете не найден каталог template.", file=sys.stderr)
|
|
20
|
+
sys.exit(1)
|
|
21
|
+
for item in src_path.iterdir():
|
|
22
|
+
dest = target_dir / item.name
|
|
23
|
+
if item.is_dir():
|
|
24
|
+
shutil.copytree(item, dest, dirs_exist_ok=True)
|
|
25
|
+
else:
|
|
26
|
+
shutil.copy2(item, dest)
|
|
27
|
+
|
|
28
|
+
print(f"Проект распакован в: {target_dir.resolve()}")
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
main()
|
|
File without changes
|
style_django-0.1.0/src/style_django/template/applications/__pycache__/__init__.cpython-313.pyc
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from django.contrib import admin
|
|
2
|
+
|
|
3
|
+
# Register your models here.
|
|
4
|
+
|
|
5
|
+
from django.contrib.auth.admin import UserAdmin
|
|
6
|
+
from .models import CustomUser, Application
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@admin.register(CustomUser)
|
|
10
|
+
class CustomUserAdmin(UserAdmin):
|
|
11
|
+
"""Настройка отображения пользователей в админке"""
|
|
12
|
+
list_display = ('username', 'fio', 'phone', 'email', 'is_staff')
|
|
13
|
+
fieldsets = UserAdmin.fieldsets + (
|
|
14
|
+
('Дополнительно', {'fields': ('fio', 'phone')}),
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@admin.register(Application)
|
|
19
|
+
class ApplicationAdmin(admin.ModelAdmin):
|
|
20
|
+
"""Настройка отображения заявок в админке"""
|
|
21
|
+
list_display = ('id', 'user', 'course_name', 'start_date', 'payment_method', 'status')
|
|
22
|
+
list_filter = ('status', 'payment_method')
|
|
23
|
+
list_editable = ('status',)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from django import forms
|
|
3
|
+
from django.contrib.auth.forms import UserCreationForm
|
|
4
|
+
from .models import CustomUser, Application
|
|
5
|
+
|
|
6
|
+
class CustomUserCreationForm(UserCreationForm):
|
|
7
|
+
"""Форма регистрации с валидацией по ТЗ"""
|
|
8
|
+
|
|
9
|
+
fio = forms.CharField(
|
|
10
|
+
max_length=150,
|
|
11
|
+
label="ФИО",
|
|
12
|
+
widget=forms.TextInput(attrs={
|
|
13
|
+
'placeholder': 'Иванов Иван',
|
|
14
|
+
'required': True
|
|
15
|
+
})
|
|
16
|
+
)
|
|
17
|
+
phone = forms.CharField(
|
|
18
|
+
max_length=20,
|
|
19
|
+
label="Телефон",
|
|
20
|
+
widget=forms.TextInput(attrs={
|
|
21
|
+
'placeholder': '8(999)123-45-67',
|
|
22
|
+
'required': True
|
|
23
|
+
})
|
|
24
|
+
)
|
|
25
|
+
email = forms.EmailField(
|
|
26
|
+
label="Email",
|
|
27
|
+
required=True,
|
|
28
|
+
widget=forms.EmailInput(attrs={
|
|
29
|
+
'placeholder': 'mail@mail.ru',
|
|
30
|
+
'required': True
|
|
31
|
+
})
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
class Meta(UserCreationForm.Meta):
|
|
35
|
+
model = CustomUser
|
|
36
|
+
fields = ("username", "fio", "phone", "email", "password1", "password2")
|
|
37
|
+
labels = {
|
|
38
|
+
'username': 'Логин',
|
|
39
|
+
'password1': 'Пароль',
|
|
40
|
+
'password2': 'Повторите пароль',
|
|
41
|
+
}
|
|
42
|
+
widgets = {
|
|
43
|
+
'username': forms.TextInput(attrs={'required': True}),
|
|
44
|
+
'password1': forms.PasswordInput(attrs={'required': True}),
|
|
45
|
+
'password2': forms.PasswordInput(attrs={'required': True}),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# 1. Логин: латиница и цифры, от 6 символов, обязательно и то, и другое
|
|
49
|
+
def clean_username(self):
|
|
50
|
+
username = self.cleaned_data.get('username')
|
|
51
|
+
if len(username) < 6:
|
|
52
|
+
raise forms.ValidationError("Логин должен быть не менее 6 символов.")
|
|
53
|
+
# Проверяем, что есть и буквы, и цифры
|
|
54
|
+
has_letter = any(c.isalpha() for c in username)
|
|
55
|
+
has_digit = any(c.isdigit() for c in username)
|
|
56
|
+
if not (has_letter and has_digit):
|
|
57
|
+
raise forms.ValidationError("Логин должен содержать и буквы, и цифры.")
|
|
58
|
+
if not re.match(r'^[a-zA-Z0-9]+$', username):
|
|
59
|
+
raise forms.ValidationError("Логин должен содержать только латинские буквы и цифры.")
|
|
60
|
+
return username
|
|
61
|
+
|
|
62
|
+
# 2. ФИО: только кириллица, минимум два слова через пробел
|
|
63
|
+
def clean_fio(self):
|
|
64
|
+
fio = self.cleaned_data.get('fio')
|
|
65
|
+
if not re.match(r'^[А-Яа-яЁё\s\-]+$', fio):
|
|
66
|
+
raise forms.ValidationError("ФИО должно содержать только кириллицу.")
|
|
67
|
+
words = fio.strip().split()
|
|
68
|
+
if len(words) < 2:
|
|
69
|
+
raise forms.ValidationError("ФИО должно содержать минимум два слова (Фамилия и Имя).")
|
|
70
|
+
return fio
|
|
71
|
+
|
|
72
|
+
# 3. Телефон: формат 8(XXX)XXX-XX-XX
|
|
73
|
+
def clean_phone(self):
|
|
74
|
+
phone = self.cleaned_data.get('phone')
|
|
75
|
+
pattern = r'^8\(\d{3}\)\d{3}-\d{2}-\d{2}$'
|
|
76
|
+
if not re.match(pattern, phone):
|
|
77
|
+
raise forms.ValidationError("Неверный формат. Пример: 8(999)123-45-67")
|
|
78
|
+
return phone
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class ApplicationForm(forms.ModelForm):
|
|
82
|
+
"""Форма создания заявки"""
|
|
83
|
+
class Meta:
|
|
84
|
+
model = Application
|
|
85
|
+
fields = ['course_name', 'start_date', 'payment_method']
|
|
86
|
+
labels = {
|
|
87
|
+
'course_name': 'Наименование курса',
|
|
88
|
+
'start_date': 'Желаемая дата начала',
|
|
89
|
+
'payment_method': 'Способ оплаты',
|
|
90
|
+
}
|
|
91
|
+
widgets = {
|
|
92
|
+
'course_name': forms.TextInput(attrs={'required': True}),
|
|
93
|
+
'start_date': forms.TextInput(attrs={
|
|
94
|
+
'placeholder': 'ДД.ММ.ГГГГ',
|
|
95
|
+
'required': True
|
|
96
|
+
}),
|
|
97
|
+
'payment_method': forms.Select(attrs={'required': True}),
|
|
98
|
+
}
|
|
99
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Generated by Django 6.1.2 on 2026-11-01 16:17
|
|
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='CustomUser',
|
|
22
|
+
fields=[
|
|
23
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
24
|
+
('password', models.CharField(max_length=128, verbose_name='password')),
|
|
25
|
+
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
|
|
26
|
+
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
|
|
27
|
+
('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')),
|
|
28
|
+
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
|
|
29
|
+
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
|
|
30
|
+
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
|
|
31
|
+
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
|
|
32
|
+
('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')),
|
|
33
|
+
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
|
34
|
+
('fio', models.CharField(max_length=150, verbose_name='ФИО')),
|
|
35
|
+
('phone', models.CharField(max_length=20, verbose_name='Телефон')),
|
|
36
|
+
('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')),
|
|
37
|
+
('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')),
|
|
38
|
+
],
|
|
39
|
+
options={
|
|
40
|
+
'verbose_name': 'user',
|
|
41
|
+
'verbose_name_plural': 'users',
|
|
42
|
+
'abstract': False,
|
|
43
|
+
},
|
|
44
|
+
managers=[
|
|
45
|
+
('objects', django.contrib.auth.models.UserManager()),
|
|
46
|
+
],
|
|
47
|
+
),
|
|
48
|
+
migrations.CreateModel(
|
|
49
|
+
name='Application',
|
|
50
|
+
fields=[
|
|
51
|
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
52
|
+
('course_name', models.CharField(max_length=200, verbose_name='Название курса')),
|
|
53
|
+
('start_date', models.CharField(max_length=20, verbose_name='Желаемая дата начала')),
|
|
54
|
+
('payment_method', models.CharField(choices=[('Наличными', 'Наличными'), ('Переводом', 'Переводом')], max_length=20, verbose_name='Способ оплаты')),
|
|
55
|
+
('status', models.CharField(choices=[('Новая', 'Новая'), ('Идёт обучение', 'Идёт обучение'), ('Обучение завершено', 'Обучение завершено')], default='Новая', max_length=20, verbose_name='Статус')),
|
|
56
|
+
('review', models.TextField(blank=True, null=True, verbose_name='Отзыв')),
|
|
57
|
+
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
|
|
58
|
+
],
|
|
59
|
+
),
|
|
60
|
+
]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 6.1.2 on 2026-11-08 17:16
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('applications', '0001_initial'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name='application',
|
|
15
|
+
name='start_date',
|
|
16
|
+
field=models.DateField(verbose_name='Желаемая дата начала'),
|
|
17
|
+
),
|
|
18
|
+
]
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
from django.contrib.auth.models import AbstractUser
|
|
3
|
+
|
|
4
|
+
class CustomUser(AbstractUser):
|
|
5
|
+
"""Пользователь портала с дополнительными полями"""
|
|
6
|
+
fio = models.CharField(
|
|
7
|
+
max_length=150,
|
|
8
|
+
verbose_name="ФИО"
|
|
9
|
+
)
|
|
10
|
+
phone = models.CharField(
|
|
11
|
+
max_length=20,
|
|
12
|
+
verbose_name="Телефон"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
def __str__(self):
|
|
16
|
+
return self.username
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Application(models.Model):
|
|
20
|
+
"""Заявка на обучение"""
|
|
21
|
+
STATUS_CHOICES = [
|
|
22
|
+
('Новая', 'Новая'),
|
|
23
|
+
('Идёт обучение', 'Идёт обучение'),
|
|
24
|
+
('Обучение завершено', 'Обучение завершено'),
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
PAYMENT_CHOICES = [
|
|
28
|
+
('Наличными', 'Наличными'),
|
|
29
|
+
('Переводом', 'Переводом'),
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
user = models.ForeignKey(
|
|
33
|
+
CustomUser,
|
|
34
|
+
on_delete=models.CASCADE,
|
|
35
|
+
verbose_name="Пользователь"
|
|
36
|
+
)
|
|
37
|
+
course_name = models.CharField(
|
|
38
|
+
max_length=200,
|
|
39
|
+
verbose_name="Название курса"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
start_date = models.DateField(
|
|
43
|
+
verbose_name="Желаемая дата начала"
|
|
44
|
+
)
|
|
45
|
+
payment_method = models.CharField(
|
|
46
|
+
max_length=20,
|
|
47
|
+
choices=PAYMENT_CHOICES,
|
|
48
|
+
verbose_name="Способ оплаты"
|
|
49
|
+
)
|
|
50
|
+
status = models.CharField(
|
|
51
|
+
max_length=20,
|
|
52
|
+
choices=STATUS_CHOICES,
|
|
53
|
+
default='Новая',
|
|
54
|
+
verbose_name="Статус"
|
|
55
|
+
)
|
|
56
|
+
review = models.TextField(
|
|
57
|
+
blank=True,
|
|
58
|
+
null=True,
|
|
59
|
+
verbose_name="Отзыв"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def __str__(self):
|
|
63
|
+
return f"Заявка #{self.id} от {self.user.username}"
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
body {
|
|
2
|
+
/* font-family: Arial, sans-serif; */
|
|
3
|
+
/* background-color: #f0f2f5; */
|
|
4
|
+
padding: 20px;
|
|
5
|
+
}
|
|
6
|
+
/* Контейнер формы */
|
|
7
|
+
.form-container {
|
|
8
|
+
max-width: 400px;
|
|
9
|
+
margin: 20px auto;
|
|
10
|
+
}
|
|
11
|
+
h2 {
|
|
12
|
+
text-align: center;
|
|
13
|
+
color: #333;
|
|
14
|
+
/* font-size: 18px; */
|
|
15
|
+
}
|
|
16
|
+
/* Группы полей */
|
|
17
|
+
.form-group {
|
|
18
|
+
margin-bottom: 10px;
|
|
19
|
+
}
|
|
20
|
+
label {
|
|
21
|
+
font-weight: bold;
|
|
22
|
+
font-size: 13px;
|
|
23
|
+
}
|
|
24
|
+
/* Поля ввода (строгие рамки) */
|
|
25
|
+
input, select, textarea {
|
|
26
|
+
width: 100%;
|
|
27
|
+
padding: 6px 8px;
|
|
28
|
+
}
|
|
29
|
+
/* --- ВАЛИДАЦИЯ (Сохранена!) --- */
|
|
30
|
+
input:invalid:not(:placeholder-shown) {
|
|
31
|
+
border-color: #d93025;
|
|
32
|
+
background-color: #fff8f8;
|
|
33
|
+
}
|
|
34
|
+
.error-text {
|
|
35
|
+
display: none;
|
|
36
|
+
color: #d93025;
|
|
37
|
+
font-size: 11px;
|
|
38
|
+
margin-top: 2px;
|
|
39
|
+
}
|
|
40
|
+
/* Показываем ошибку, если поле невалидно */
|
|
41
|
+
input:invalid:not(:placeholder-shown) ~ .error-text {
|
|
42
|
+
display: block;
|
|
43
|
+
}
|
|
44
|
+
/* Текст ошибок под полями */
|
|
45
|
+
.error {
|
|
46
|
+
color: #d93025;
|
|
47
|
+
font-size: 13px;
|
|
48
|
+
margin: 5px 0;
|
|
49
|
+
}
|
|
50
|
+
.error-list {
|
|
51
|
+
border: 1px solid #d93025;
|
|
52
|
+
padding: 10px;
|
|
53
|
+
margin-bottom: 15px;
|
|
54
|
+
}
|
|
55
|
+
/* --- КНОПКИ --- */
|
|
56
|
+
button {
|
|
57
|
+
padding: 10px;
|
|
58
|
+
background-color: #ff8800;
|
|
59
|
+
width: 100%;
|
|
60
|
+
}
|
|
61
|
+
/* Ссылки (Войти / Регистрация) */
|
|
62
|
+
.link {
|
|
63
|
+
text-align: center;
|
|
64
|
+
margin-top: 15px;
|
|
65
|
+
font-size: 13px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* --- ТОСТЫ (Сохранены!) --- */
|
|
69
|
+
.toast {
|
|
70
|
+
position: fixed;
|
|
71
|
+
top: 20px;
|
|
72
|
+
right: 20px;
|
|
73
|
+
background-color: #28a745;
|
|
74
|
+
color: white;
|
|
75
|
+
padding: 12px 20px;
|
|
76
|
+
z-index: 1000;
|
|
77
|
+
animation: showToast 3.3s forwards;
|
|
78
|
+
}
|
|
79
|
+
.toast.error {
|
|
80
|
+
background-color: #d93025;
|
|
81
|
+
}
|
|
82
|
+
@keyframes showToast {
|
|
83
|
+
0% { opacity: 0; }
|
|
84
|
+
10% { opacity: 1; }
|
|
85
|
+
90% { opacity: 1; }
|
|
86
|
+
100% { opacity: 0; }
|
|
87
|
+
}
|
|
88
|
+
/* --- ТАБЛИЦА --- */
|
|
89
|
+
table {
|
|
90
|
+
width: 100%;
|
|
91
|
+
border-collapse: collapse;
|
|
92
|
+
margin-top: 20px;
|
|
93
|
+
}
|
|
94
|
+
th, td {
|
|
95
|
+
border: 1px solid #fa1b1b;
|
|
96
|
+
padding: 10px;
|
|
97
|
+
text-align: left;
|
|
98
|
+
font-size: 13px;
|
|
99
|
+
}
|
|
100
|
+
th {
|
|
101
|
+
/* background-color: #f8f9fa; */
|
|
102
|
+
font-weight: bold;
|
|
103
|
+
}
|
style_django-0.1.0/src/style_django/template/applications/templates/applications/admin_panel.html
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{% extends 'applications/base.html' %}
|
|
2
|
+
|
|
3
|
+
{% block content %}
|
|
4
|
+
<h2>Все заявки</h2>
|
|
5
|
+
<p>Вы вошли как: <strong>Администратор</strong> | <a href="{% url 'logout' %}">Выйти</a></p>
|
|
6
|
+
|
|
7
|
+
{% for message in messages %}
|
|
8
|
+
<div class="toast">{{ message }}</div>
|
|
9
|
+
{% endfor %}
|
|
10
|
+
|
|
11
|
+
<table>
|
|
12
|
+
<thead>
|
|
13
|
+
<tr>
|
|
14
|
+
<th>ID</th>
|
|
15
|
+
<th>Курс</th>
|
|
16
|
+
<th>Дата</th>
|
|
17
|
+
<th>Оплата</th>
|
|
18
|
+
<th>Статус</th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
{% for app in applications %}
|
|
23
|
+
<tr>
|
|
24
|
+
<td>{{ app.id }}</td>
|
|
25
|
+
<td>{{ app.course_name }}</td>
|
|
26
|
+
<td>{{ app.start_date }}</td>
|
|
27
|
+
<td>{{ app.payment_method }}</td>
|
|
28
|
+
<td>
|
|
29
|
+
<form method="post">
|
|
30
|
+
{% csrf_token %}
|
|
31
|
+
<input type="hidden" name="app_id" value="{{ app.id }}">
|
|
32
|
+
<select name="status" onchange="this.form.submit()">
|
|
33
|
+
<option value="Новая" {% if app.status == 'Новая' %}selected{% endif %}>Новая</option>
|
|
34
|
+
<option value="Идёт обучение" {% if app.status == 'Идёт обучение' %}selected{% endif %}>Идёт обучение</option>
|
|
35
|
+
<option value="Обучение завершено" {% if app.status == 'Обучение завершено' %}selected{% endif %}>Обучение завершено</option>
|
|
36
|
+
</select>
|
|
37
|
+
</form>
|
|
38
|
+
</td>
|
|
39
|
+
</tr>
|
|
40
|
+
{% empty %}
|
|
41
|
+
<tr>
|
|
42
|
+
<td colspan="5">Заявок нет.</td>
|
|
43
|
+
</tr>
|
|
44
|
+
{% endfor %}
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
{% endblock %}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{% extends 'applications/base.html' %}
|
|
2
|
+
|
|
3
|
+
{% block title %}Новая заявка - Корочки.есть{% endblock %}
|
|
4
|
+
|
|
5
|
+
{% block content %}
|
|
6
|
+
<div class="form-container">
|
|
7
|
+
<h2>Новая заявка</h2>
|
|
8
|
+
|
|
9
|
+
{% if form.errors %}
|
|
10
|
+
<div class="error-list">
|
|
11
|
+
{{ form.errors }}
|
|
12
|
+
</div>
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
<form method="post">
|
|
16
|
+
{% csrf_token %}
|
|
17
|
+
|
|
18
|
+
<div class="form-group">
|
|
19
|
+
<label for="id_course_name">Наименование курса</label>
|
|
20
|
+
<input type="text" name="course_name" id="id_course_name" placeholder="Например: Основы веб-дизайна"
|
|
21
|
+
required>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="form-group">
|
|
25
|
+
<label for="id_start_date">Желаемая дата начала</label>
|
|
26
|
+
<input type="date" name="start_date" id="id_start_date" required>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="form-group">
|
|
30
|
+
<label for="id_payment_method">Способ оплаты</label>
|
|
31
|
+
<select name="payment_method" id="id_payment_method" required>
|
|
32
|
+
<option value="" disabled selected>Выберите способ оплаты</option>
|
|
33
|
+
<option value="Наличными">Наличными</option>
|
|
34
|
+
<option value="Переводом">Перевод по номеру телефона</option>
|
|
35
|
+
</select>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<button type="submit">Отправить</button>
|
|
39
|
+
</form>
|
|
40
|
+
|
|
41
|
+
<p class="link"><a href="{% url 'my_applications' %}">← Вернуться к моим заявкам</a></p>
|
|
42
|
+
</div>
|
|
43
|
+
{% endblock %}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="ru">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>{% block title %}Корочки.есть{% endblock %}</title>
|
|
7
|
+
{% load static %}
|
|
8
|
+
<link rel="stylesheet" href="{% static 'applications/style.css' %}">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<main>
|
|
12
|
+
{% block content %}{% endblock %}
|
|
13
|
+
</main>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{% extends 'applications/base.html' %}
|
|
2
|
+
|
|
3
|
+
{% block title %}Вход - Корочки.есть{% endblock %}
|
|
4
|
+
|
|
5
|
+
{% block content %}
|
|
6
|
+
<div class="form-container">
|
|
7
|
+
<h2>Вход</h2>
|
|
8
|
+
<form method="post">
|
|
9
|
+
{% csrf_token %}
|
|
10
|
+
|
|
11
|
+
{% if form.errors %}
|
|
12
|
+
<div class="error-list">
|
|
13
|
+
<p class="error">Неверный логин или пароль.</p>
|
|
14
|
+
</div>
|
|
15
|
+
{% endif %}
|
|
16
|
+
|
|
17
|
+
<div class="form-group">
|
|
18
|
+
<label for="id_username">Логин</label>
|
|
19
|
+
<input type="text" name="username" id="id_username" placeholder=" " required>
|
|
20
|
+
<span class="error-text">Введите логин</span>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="form-group">
|
|
24
|
+
<label for="id_password">Пароль</label>
|
|
25
|
+
<input type="password" name="password" id="id_password" placeholder=" " required>
|
|
26
|
+
<span class="error-text">Введите пароль</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<button type="submit">Войти</button>
|
|
30
|
+
</form>
|
|
31
|
+
|
|
32
|
+
<p class="link">Ещё не зарегистрированы? <a href="{% url 'register' %}">Регистрация</a></p>
|
|
33
|
+
</div>
|
|
34
|
+
{% endblock %}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{% extends 'applications/base.html' %}
|
|
2
|
+
|
|
3
|
+
{% block content %}
|
|
4
|
+
<h2>Мои заявки</h2>
|
|
5
|
+
|
|
6
|
+
<a href="{% url 'create_application' %}">+ Создать заявку</a> |
|
|
7
|
+
<a href="{% url 'logout' %}">Выйти</a>
|
|
8
|
+
|
|
9
|
+
{% for message in messages %}
|
|
10
|
+
<div class="toast">{{ message }}</div>
|
|
11
|
+
{% endfor %}
|
|
12
|
+
|
|
13
|
+
<table>
|
|
14
|
+
<thead>
|
|
15
|
+
<tr>
|
|
16
|
+
<th>Курс</th>
|
|
17
|
+
<th>Дата</th>
|
|
18
|
+
<th>Оплата</th>
|
|
19
|
+
<th>Статус</th>
|
|
20
|
+
</tr>
|
|
21
|
+
</thead>
|
|
22
|
+
<tbody>
|
|
23
|
+
{% for app in applications %}
|
|
24
|
+
<tr>
|
|
25
|
+
<td>{{ app.course_name }}</td>
|
|
26
|
+
<td>{{ app.start_date }}</td>
|
|
27
|
+
<td>{{ app.payment_method }}</td>
|
|
28
|
+
<td>
|
|
29
|
+
<span class="status-{% if app.status == 'Новая' %}new{% elif app.status == 'Идёт обучение' %}active{% else %}done{% endif %}">
|
|
30
|
+
{{ app.status }}
|
|
31
|
+
</span>
|
|
32
|
+
</td>
|
|
33
|
+
</tr>
|
|
34
|
+
{% empty %}
|
|
35
|
+
<tr>
|
|
36
|
+
<td colspan="4">У вас пока нет заявок.</td>
|
|
37
|
+
</tr>
|
|
38
|
+
{% endfor %}
|
|
39
|
+
</tbody>
|
|
40
|
+
</table>
|
|
41
|
+
|
|
42
|
+
<h3>Оставить отзыв</h3>
|
|
43
|
+
|
|
44
|
+
<div class="form-container">
|
|
45
|
+
<form method="post" action="{% url 'add_review' %}">
|
|
46
|
+
{% csrf_token %}
|
|
47
|
+
<textarea name="review" placeholder="Ваш отзыв..." required></textarea>
|
|
48
|
+
<button type="submit">Отправить отзыв</button>
|
|
49
|
+
</form>
|
|
50
|
+
</div>
|
|
51
|
+
{% endblock %}
|
style_django-0.1.0/src/style_django/template/applications/templates/applications/register.html
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{% extends 'applications/base.html' %}
|
|
2
|
+
|
|
3
|
+
{% block title %}Регистрация - Корочки.есть{% endblock %}
|
|
4
|
+
|
|
5
|
+
{% block content %}
|
|
6
|
+
<div class="form-container">
|
|
7
|
+
<h2>Регистрация</h2>
|
|
8
|
+
<form method="post">
|
|
9
|
+
{% csrf_token %}
|
|
10
|
+
|
|
11
|
+
<div class="form-group">
|
|
12
|
+
<label for="id_username">Логин</label>
|
|
13
|
+
<input type="text" name="username" id="id_username" placeholder=" " minlength="6"
|
|
14
|
+
pattern="(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z0-9]{6,}"
|
|
15
|
+
title="Логин должен содержать минимум 6 символов, включая буквы и цифры" required>
|
|
16
|
+
<span class="error-text">Латиница и цифры (от 6 символов, обязательно и то, и другое)</span>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div class="form-group">
|
|
20
|
+
<label for="id_password1">Пароль</label>
|
|
21
|
+
<input type="password" name="password1" id="id_password1" placeholder=" " minlength="8"
|
|
22
|
+
pattern="(?=.*[a-zA-Z])(?=.*\d).{8,}"
|
|
23
|
+
title="Пароль должен содержать минимум 8 символов, включая буквы и цифры" required>
|
|
24
|
+
<span class="error-text">Пароль должен быть от 8 символов</span>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="form-group">
|
|
28
|
+
<label for="id_password2">Повторите пароль</label>
|
|
29
|
+
<input type="password" name="password2" id="id_password2" placeholder=" " minlength="8" required>
|
|
30
|
+
<span class="error-text">Пароли не совпадают</span>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="form-group">
|
|
34
|
+
<label for="id_fio">ФИО</label>
|
|
35
|
+
<input type="text" name="fio" id="id_fio" placeholder=" " pattern="[А-Яа-яЁё\-]+( [А-Яа-яЁё\-]+)+"
|
|
36
|
+
title="ФИО должно содержать минимум два слова через пробел" required>
|
|
37
|
+
<span class="error-text">Только кириллица, минимум два слова (Фамилия и Имя) через пробел</span>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class="form-group">
|
|
41
|
+
<label for="id_phone">Телефон</label>
|
|
42
|
+
<input type="text" name="phone" id="id_phone" placeholder=" "
|
|
43
|
+
pattern="8\([0-9]{3}\)[0-9]{3}-[0-9]{2}-[0-9]{2}" title="Формат: 8(999)123-45-67" required>
|
|
44
|
+
<span class="error-text">Формат: 8(999)123-45-67</span>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div class="form-group">
|
|
48
|
+
<label for="id_email">Email</label>
|
|
49
|
+
<input type="email" name="email" id="id_email" placeholder=" " required>
|
|
50
|
+
<span class="error-text">Введите корректный email</span>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<button type="submit">Создать пользователя</button>
|
|
54
|
+
</form>
|
|
55
|
+
|
|
56
|
+
<p class="link">Уже есть аккаунт? <a href="{% url 'login' %}">Войти</a></p>
|
|
57
|
+
</div>
|
|
58
|
+
{% endblock %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from django.urls import path
|
|
2
|
+
from . import views
|
|
3
|
+
|
|
4
|
+
urlpatterns = [
|
|
5
|
+
path('register/', views.register, name='register'),
|
|
6
|
+
path('login/', views.user_login, name='login'),
|
|
7
|
+
path('logout/', views.user_logout, name='logout'),
|
|
8
|
+
path('application/new/', views.create_application, name='create_application'),
|
|
9
|
+
path('applications/', views.my_applications, name='my_applications'),
|
|
10
|
+
path('add_review/', views.add_review, name='add_review'),
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
path('admin-panel/', views.admin_panel, name='admin_panel'),
|
|
14
|
+
]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# from django.shortcuts import render
|
|
2
|
+
|
|
3
|
+
# Create your views here.
|
|
4
|
+
from django.shortcuts import render, redirect, get_object_or_404
|
|
5
|
+
from django.contrib.auth import login, logout
|
|
6
|
+
from django.contrib.auth.decorators import login_required
|
|
7
|
+
from django.contrib.auth.forms import AuthenticationForm
|
|
8
|
+
from .forms import CustomUserCreationForm, ApplicationForm
|
|
9
|
+
from .models import Application
|
|
10
|
+
from django.contrib import messages # в начало файла
|
|
11
|
+
from django.contrib.auth.decorators import login_required, user_passes_test # для адимнки не для встр
|
|
12
|
+
|
|
13
|
+
# для алминаААААА
|
|
14
|
+
def check_admin(user):
|
|
15
|
+
return user.username == 'Admin'
|
|
16
|
+
|
|
17
|
+
@user_passes_test(check_admin, login_url='login')
|
|
18
|
+
def admin_panel(request):
|
|
19
|
+
if request.method == 'POST':
|
|
20
|
+
app_id = request.POST.get('app_id')
|
|
21
|
+
new_status = request.POST.get('status')
|
|
22
|
+
Application.objects.filter(id=app_id).update(status=new_status)
|
|
23
|
+
messages.success(request, 'Статус обновлен!')
|
|
24
|
+
return redirect('admin_panel')
|
|
25
|
+
|
|
26
|
+
apps = Application.objects.all().order_by('-id')
|
|
27
|
+
return render(request, 'applications/admin_panel.html', {'applications': apps})
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def register(request):
|
|
32
|
+
if request.method == 'POST':
|
|
33
|
+
form = CustomUserCreationForm(request.POST)
|
|
34
|
+
if form.is_valid():
|
|
35
|
+
user = form.save()
|
|
36
|
+
login(request, user)
|
|
37
|
+
return redirect('my_applications')
|
|
38
|
+
else:
|
|
39
|
+
form = CustomUserCreationForm()
|
|
40
|
+
return render(request, 'applications/register.html', {'form': form})
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def user_login(request):
|
|
44
|
+
if request.method == 'POST':
|
|
45
|
+
form = AuthenticationForm(request, data=request.POST)
|
|
46
|
+
if form.is_valid():
|
|
47
|
+
user = form.get_user()
|
|
48
|
+
login(request, user)
|
|
49
|
+
# Если зашел Админ - кидаем в его панель, иначе - в заявки
|
|
50
|
+
if user.username == 'Admin':
|
|
51
|
+
return redirect('admin_panel')
|
|
52
|
+
return redirect('my_applications')
|
|
53
|
+
else:
|
|
54
|
+
form = AuthenticationForm()
|
|
55
|
+
return render(request, 'applications/login.html', {'form': form})
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def user_logout(request):
|
|
59
|
+
logout(request)
|
|
60
|
+
return redirect('login')
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@login_required
|
|
64
|
+
def create_application(request):
|
|
65
|
+
if request.method == 'POST':
|
|
66
|
+
form = ApplicationForm(request.POST)
|
|
67
|
+
if form.is_valid():
|
|
68
|
+
app = form.save(commit=False)
|
|
69
|
+
app.user = request.user
|
|
70
|
+
app.save()
|
|
71
|
+
return redirect('my_applications')
|
|
72
|
+
else:
|
|
73
|
+
form = ApplicationForm()
|
|
74
|
+
return render(request, 'applications/application_form.html', {'form': form})
|
|
75
|
+
|
|
76
|
+
@login_required
|
|
77
|
+
def my_applications(request):
|
|
78
|
+
apps = Application.objects.filter(user=request.user)
|
|
79
|
+
return render(request, 'applications/my_applications.html', {'applications': apps})
|
|
80
|
+
|
|
81
|
+
@login_required
|
|
82
|
+
def add_review(request):
|
|
83
|
+
"""Сохранение отзыва в последнюю заявку пользователя"""
|
|
84
|
+
if request.method == 'POST':
|
|
85
|
+
review_text = request.POST.get('review')
|
|
86
|
+
if review_text:
|
|
87
|
+
last_app = Application.objects.filter(user=request.user).order_by('-id').first()
|
|
88
|
+
if last_app:
|
|
89
|
+
last_app.review = review_text
|
|
90
|
+
last_app.save()
|
|
91
|
+
messages.success(request, '✅ Спасибо! Ваш отзыв отправлен.')
|
|
92
|
+
else:
|
|
93
|
+
messages.error(request, '❌ У вас нет заявок для отзыва.')
|
|
94
|
+
else:
|
|
95
|
+
messages.error(request, '❌ Отзыв не может быть пустым.')
|
|
96
|
+
return redirect('my_applications')
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ASGI config for config project.
|
|
3
|
+
|
|
4
|
+
It exposes the ASGI callable as a module-level variable named ``application``.
|
|
5
|
+
|
|
6
|
+
For more information on this file, see
|
|
7
|
+
https://docs.djangoproject.com/en/6.1/howto/deployment/asgi/
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from django.core.asgi import get_asgi_application
|
|
13
|
+
|
|
14
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
|
15
|
+
|
|
16
|
+
application = get_asgi_application()
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Django settings for config project.
|
|
3
|
+
|
|
4
|
+
Generated by 'django-admin startproject' using Django 6.1.2.
|
|
5
|
+
|
|
6
|
+
For more information on this file, see
|
|
7
|
+
https://docs.djangoproject.com/en/6.1/topics/settings/
|
|
8
|
+
|
|
9
|
+
For the full list of settings and their values, see
|
|
10
|
+
https://docs.djangoproject.com/en/6.1/ref/settings/
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
16
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Quick-start development settings - unsuitable for production
|
|
20
|
+
# See https://docs.djangoproject.com/en/6.1/howto/deployment/checklist/
|
|
21
|
+
|
|
22
|
+
# SECURITY WARNING: keep the secret key used in production secret!
|
|
23
|
+
SECRET_KEY = 'django-insecure-nlp(1b0cx21y-lfab$h8+t%r8w$v9ff0l=f%p^@ug$2i7e)86p'
|
|
24
|
+
|
|
25
|
+
# SECURITY WARNING: don't run with debug turned on in production!
|
|
26
|
+
DEBUG = True
|
|
27
|
+
|
|
28
|
+
ALLOWED_HOSTS = []
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Application definition
|
|
32
|
+
|
|
33
|
+
INSTALLED_APPS = [
|
|
34
|
+
'django.contrib.admin',
|
|
35
|
+
'django.contrib.auth',
|
|
36
|
+
'django.contrib.contenttypes',
|
|
37
|
+
'django.contrib.sessions',
|
|
38
|
+
'django.contrib.messages',
|
|
39
|
+
'django.contrib.staticfiles',
|
|
40
|
+
"applications",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
MIDDLEWARE = [
|
|
44
|
+
'django.middleware.security.SecurityMiddleware',
|
|
45
|
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
46
|
+
'django.middleware.common.CommonMiddleware',
|
|
47
|
+
'django.middleware.csrf.CsrfViewMiddleware',
|
|
48
|
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
49
|
+
'django.contrib.messages.middleware.MessageMiddleware',
|
|
50
|
+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
ROOT_URLCONF = 'config.urls'
|
|
54
|
+
|
|
55
|
+
TEMPLATES = [
|
|
56
|
+
{
|
|
57
|
+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
58
|
+
'DIRS': [],
|
|
59
|
+
'APP_DIRS': True,
|
|
60
|
+
'OPTIONS': {
|
|
61
|
+
'context_processors': [
|
|
62
|
+
'django.template.context_processors.request',
|
|
63
|
+
'django.contrib.auth.context_processors.auth',
|
|
64
|
+
'django.contrib.messages.context_processors.messages',
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
WSGI_APPLICATION = 'config.wsgi.application'
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# Database
|
|
74
|
+
# https://docs.djangoproject.com/en/6.1/ref/settings/#databases
|
|
75
|
+
|
|
76
|
+
DATABASES = {
|
|
77
|
+
'default': {
|
|
78
|
+
"ENGINE": "django.db.backends.postgresql",
|
|
79
|
+
"NAME": "course_portal",
|
|
80
|
+
"USER": "postgres",
|
|
81
|
+
"PASSWORD": "1234",
|
|
82
|
+
"HOST": "localhost",
|
|
83
|
+
"PORT": "5432",
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# Password validation
|
|
89
|
+
# https://docs.djangoproject.com/en/6.1/ref/settings/#auth-password-validators
|
|
90
|
+
|
|
91
|
+
AUTH_PASSWORD_VALIDATORS = [
|
|
92
|
+
{
|
|
93
|
+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
|
103
|
+
},
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# Internationalization
|
|
108
|
+
# https://docs.djangoproject.com/en/6.1/topics/i18n/
|
|
109
|
+
|
|
110
|
+
LANGUAGE_CODE = 'ru'
|
|
111
|
+
|
|
112
|
+
TIME_ZONE = 'UTC'
|
|
113
|
+
|
|
114
|
+
USE_I18N = True
|
|
115
|
+
|
|
116
|
+
USE_TZ = True
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# Static files (CSS, JavaScript, Images)
|
|
120
|
+
# https://docs.djangoproject.com/en/6.1/howto/static-files/
|
|
121
|
+
|
|
122
|
+
STATIC_URL = 'static/'
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# Email
|
|
126
|
+
# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration
|
|
127
|
+
|
|
128
|
+
MAILERS = {
|
|
129
|
+
'default': {
|
|
130
|
+
'BACKEND': 'django.core.mail.backends.console.EmailBackend',
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
AUTH_USER_MODEL = 'applications.CustomUser'
|
|
135
|
+
|
|
136
|
+
LOGIN_URL = 'login'
|
|
137
|
+
LOGIN_REDIRECT_URL = 'my_applications'
|
|
138
|
+
LOGOUT_REDIRECT_URL = 'login'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
URL configuration for config project.
|
|
3
|
+
|
|
4
|
+
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
5
|
+
https://docs.djangoproject.com/en/6.1/topics/http/urls/
|
|
6
|
+
Examples:
|
|
7
|
+
Function views
|
|
8
|
+
1. Add an import: from my_app import views
|
|
9
|
+
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
|
10
|
+
Class-based views
|
|
11
|
+
1. Add an import: from other_app.views import Home
|
|
12
|
+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
|
13
|
+
Including another URLconf
|
|
14
|
+
1. Import the include() function: from django.urls import include, path
|
|
15
|
+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
|
16
|
+
"""
|
|
17
|
+
from django.contrib import admin
|
|
18
|
+
from django.urls import path, include
|
|
19
|
+
from django.views.generic import RedirectView
|
|
20
|
+
|
|
21
|
+
urlpatterns = [
|
|
22
|
+
path('admin/', admin.site.urls),
|
|
23
|
+
path('', RedirectView.as_view(url='/register/', permanent=False)),
|
|
24
|
+
path('', include('applications.urls')),
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
WSGI config for config project.
|
|
3
|
+
|
|
4
|
+
It exposes the WSGI callable as a module-level variable named ``application``.
|
|
5
|
+
|
|
6
|
+
For more information on this file, see
|
|
7
|
+
https://docs.djangoproject.com/en/6.1/howto/deployment/wsgi/
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from django.core.wsgi import get_wsgi_application
|
|
13
|
+
|
|
14
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
|
15
|
+
|
|
16
|
+
application = get_wsgi_application()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""Django's command-line utility for administrative tasks."""
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main():
|
|
8
|
+
"""Run administrative tasks."""
|
|
9
|
+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
|
10
|
+
try:
|
|
11
|
+
from django.core.management import execute_from_command_line
|
|
12
|
+
except ImportError as exc:
|
|
13
|
+
raise ImportError(
|
|
14
|
+
"Couldn't import Django. Are you sure it's installed and "
|
|
15
|
+
"available on your PYTHONPATH environment variable? Did you "
|
|
16
|
+
"forget to activate a virtual environment?"
|
|
17
|
+
) from exc
|
|
18
|
+
execute_from_command_line(sys.argv)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
if __name__ == '__main__':
|
|
22
|
+
main()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
pyproject.toml
|
|
2
|
+
src/style_django/__init__.py
|
|
3
|
+
src/style_django/cli.py
|
|
4
|
+
src/style_django.egg-info/PKG-INFO
|
|
5
|
+
src/style_django.egg-info/SOURCES.txt
|
|
6
|
+
src/style_django.egg-info/dependency_links.txt
|
|
7
|
+
src/style_django.egg-info/entry_points.txt
|
|
8
|
+
src/style_django.egg-info/top_level.txt
|
|
9
|
+
src/style_django/template/manage.py
|
|
10
|
+
src/style_django/template/applications/__init__.py
|
|
11
|
+
src/style_django/template/applications/admin.py
|
|
12
|
+
src/style_django/template/applications/apps.py
|
|
13
|
+
src/style_django/template/applications/forms.py
|
|
14
|
+
src/style_django/template/applications/models.py
|
|
15
|
+
src/style_django/template/applications/tests.py
|
|
16
|
+
src/style_django/template/applications/urls.py
|
|
17
|
+
src/style_django/template/applications/views.py
|
|
18
|
+
src/style_django/template/applications/__pycache__/__init__.cpython-313.pyc
|
|
19
|
+
src/style_django/template/applications/__pycache__/admin.cpython-313.pyc
|
|
20
|
+
src/style_django/template/applications/__pycache__/apps.cpython-313.pyc
|
|
21
|
+
src/style_django/template/applications/__pycache__/forms.cpython-313.pyc
|
|
22
|
+
src/style_django/template/applications/__pycache__/models.cpython-313.pyc
|
|
23
|
+
src/style_django/template/applications/__pycache__/urls.cpython-313.pyc
|
|
24
|
+
src/style_django/template/applications/__pycache__/views.cpython-313.pyc
|
|
25
|
+
src/style_django/template/applications/migrations/0001_initial.py
|
|
26
|
+
src/style_django/template/applications/migrations/0002_alter_application_start_date.py
|
|
27
|
+
src/style_django/template/applications/migrations/__init__.py
|
|
28
|
+
src/style_django/template/applications/migrations/__pycache__/0001_initial.cpython-313.pyc
|
|
29
|
+
src/style_django/template/applications/migrations/__pycache__/0002_alter_application_start_date.cpython-313.pyc
|
|
30
|
+
src/style_django/template/applications/migrations/__pycache__/__init__.cpython-313.pyc
|
|
31
|
+
src/style_django/template/applications/static/applications/style.css
|
|
32
|
+
src/style_django/template/applications/templates/applications/admin_panel.html
|
|
33
|
+
src/style_django/template/applications/templates/applications/application_form.html
|
|
34
|
+
src/style_django/template/applications/templates/applications/base.html
|
|
35
|
+
src/style_django/template/applications/templates/applications/login.html
|
|
36
|
+
src/style_django/template/applications/templates/applications/my_applications.html
|
|
37
|
+
src/style_django/template/applications/templates/applications/register.html
|
|
38
|
+
src/style_django/template/config/__init__.py
|
|
39
|
+
src/style_django/template/config/asgi.py
|
|
40
|
+
src/style_django/template/config/settings.py
|
|
41
|
+
src/style_django/template/config/urls.py
|
|
42
|
+
src/style_django/template/config/wsgi.py
|
|
43
|
+
src/style_django/template/config/__pycache__/__init__.cpython-313.pyc
|
|
44
|
+
src/style_django/template/config/__pycache__/settings.cpython-313.pyc
|
|
45
|
+
src/style_django/template/config/__pycache__/urls.cpython-313.pyc
|
|
46
|
+
src/style_django/template/config/__pycache__/wsgi.cpython-313.pyc
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
style_django
|