diff --git a/main/migrations/0017_auto_20210408_1943.py b/main/migrations/0017_auto_20210408_1943.py new file mode 100644 index 0000000..4db02cf --- /dev/null +++ b/main/migrations/0017_auto_20210408_1943.py @@ -0,0 +1,26 @@ +# Generated by Django 3.1.7 on 2021-04-08 16:43 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('main', '0016_merge_20210330_0043'), + ] + + operations = [ + migrations.AlterField( + model_name='unassignedticket', + name='assignee', + field=models.ForeignKey(help_text='Пользователь, с которого снят тикет', on_delete=django.db.models.deletion.CASCADE, related_name='tickets', to=settings.AUTH_USER_MODEL), + ), + migrations.AlterField( + model_name='unassignedticket', + name='status', + field=models.IntegerField(choices=[(0, 'Снят с пользователя, перенесён в буферную группу'), (1, 'Авторство восстановлено'), (2, 'Пока нас не было, тикет испарился из буферной группы. Дополнительные действия не требуются'), (3, 'Тикет уже был закрыт. Дополнительные действия не требуются'), (4, 'Тикет решён. Записан на пользователя с почтой SOLVED_TICKETS_EMAIL')], default=0, help_text='Статус тикета'), + ), + ] diff --git a/main/templates/base/menu.html b/main/templates/base/menu.html index a56b4be..93799a5 100644 --- a/main/templates/base/menu.html +++ b/main/templates/base/menu.html @@ -35,8 +35,18 @@ {% else %}
{% endif %} diff --git a/main/views.py b/main/views.py index 4952b60..b3efaa1 100644 --- a/main/views.py +++ b/main/views.py @@ -35,6 +35,19 @@ from main.serializers import ProfileSerializer from .models import UserProfile +def setup_context(profile_lit: bool = False, control_lit: bool = False, work_lit: bool = False, + registration_lit: bool = False, login_lit: bool = False): + print(profile_lit, control_lit, work_lit, registration_lit, login_lit) + context = { + 'profile_lit': profile_lit, + 'control_lit': control_lit, + 'work_lit': work_lit, + 'registration_lit': registration_lit, + 'login_lit': login_lit, + } + return context + + class CustomRegistrationView(RegistrationView): """ Отображение и логика работы страницы регистрации пользователя. @@ -48,6 +61,7 @@ class CustomRegistrationView(RegistrationView): :param is_allowed: Определение зарегистрирован ли пользователь с введенным email на Zendesk и принадлежит ли он к организации SYSTEM :type is_allowed: :class:`bool` """ + extra_context = setup_context(registration_lit=True) form_class = CustomRegistrationForm template_name = 'django_registration/registration_form.html' success_url = reverse_lazy('django_registration_complete') @@ -121,15 +135,6 @@ class CustomRegistrationView(RegistrationView): return reverse_lazy('django_registration_disallowed') -def setup_context(profile_lit: bool = False, control_lit: bool = False, work_lit: bool = False): - context = { - 'profile_lit': profile_lit, - 'control_lit': control_lit, - 'work_lit': work_lit, - } - return context - - @login_required() def profile_page(request: WSGIRequest) -> HttpResponse: """ @@ -313,6 +318,7 @@ class CustomLoginView(LoginView): """ Отображение страницы авторизации пользователя """ + extra_context = setup_context(login_lit=True) form_class = CustomAuthenticationForm