Commit def0b55b authored by Isataev Adlet's avatar Isataev Adlet

ДЗ 71

parent 6aad1dee
......@@ -4,3 +4,4 @@ pytz==2021.3
sqlparse==0.4.2
Pillow==8.4.0
django-crispy-forms==1.13.0
django-modeltranslation==0.17.3
\ No newline at end of file
from django.utils.translation import gettext_lazy as _
from django.db import models
from django.contrib.auth import get_user_model
class Gender(models.Model):
name = models.CharField(max_length=15, verbose_name="Пол")
name = models.CharField(max_length=15, verbose_name=_("Gender"))
def __str__(self):
return f'{self.name}'
......@@ -11,13 +12,13 @@ class Gender(models.Model):
class Profile(models.Model):
user = models.OneToOneField(get_user_model(), related_name="profile", on_delete=models.CASCADE,
verbose_name="Пользователь")
verbose_name=_("User"))
birth_date = models.DateField(null=True, blank=True, verbose_name="Дата рождения")
birth_date = models.DateField(null=True, blank=True, verbose_name=_("BirthDate"))
phone_number = models.CharField(null=True, blank=True, max_length=25, verbose_name="Номер телефона")
phone_number = models.CharField(null=True, blank=True, max_length=25, verbose_name=_("PhoneNumber"))
gender = models.ForeignKey(Gender, null=True, blank=True, on_delete=models.PROTECT, verbose_name="Пол пользователя")
gender = models.ForeignKey(Gender, null=True, blank=True, on_delete=models.PROTECT, verbose_name=_("GenderUser"))
......
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load i18n %}
{% block title %}Изменить пароль{% endblock %}
{% block content %}
<h1>Изменить пароль {{ user_obj.username }}</h1>
<h1>{% trans "ChangePasswordTitle" %} {{ user_obj.username }}</h1>
<form action="{% url "change_password" user_obj.pk %}" method="post">
{% csrf_token %}
{{ form|crispy }}
<button>Изменить</button>
<button>{% trans "ChangePasswordBtn" %}</button>
</form>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load i18n %}
{% block title %}Edit {{ user_obj.username }}{% endblock %}
{% block content %}
<h1>Редактирование профиля</h1>
<h1>{% trans "EditProfileTitle" %}</h1>
<form
action="{% url "edit_profile" user_obj.pk %}"
method="post"
......@@ -12,6 +13,6 @@
{% csrf_token %}
{{ user_form|crispy }}
{{ profile_form|crispy }}
<button>Редактировать</button>
<button>{% trans "EditProfileBtn" %}</button>
</form>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% load i18n %}
{% block title %}Login{% endblock %}
{% block content %}
<div class="mt-5">
<h1>Вход</h1>
<h1>{% trans "loginTitle" %}</h1>
<form action="{% url "login" %}" method="post">
{% csrf_token %}
{% if has_error %}
<p>Wrong username or password</p>
<p>{% trans "WrongMessLoginPassword" %}</p>
{% endif %}
<p><input type="text" name="username" placeholder="Username"></p>
<p><input type="password" name="password" placeholder="Password"></p>
<p><input type="text" name="username" placeholder="{% trans "Username" %}"></p>
<p><input type="password" name="password" placeholder="{% trans "Password" %}"></p>
<input type="hidden" name="next" value="{{ request.GET.next }}">
<button>Войти</button>
<button>{% trans "LoginBtn" %}</button>
</form>
</div>
......
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load i18n %}
{% block title %}Register{% endblock %}
......@@ -8,7 +9,7 @@
<form action="{% url "register" %}" method="post">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary">Регистрация</button>
<button class="btn btn-primary">{% trans "RegistrationBtn" %}</button>
</form>
</div>
......
{% extends "base.html" %}
{% load i18n %}
{% block title %}User {{ user_obj.username }}{% endblock %}
{% block content %}
<h1 class="mt-5">Профиль {{ user_obj.username }}</h1>
<h1 class="mt-5">{% trans "ProfileTitle" %} {{ user_obj.username }}</h1>
{% ifequal user user_obj %}
<div class="mt-3 mb-3">
<a href="{% url "edit_profile" user_obj.pk %}" class="btn btn-info">
Edit account
{% trans "EditProfileBtn" %}
</a>
<a href="{% url "change_password" user_obj.pk %}" class="ml-5 btn btn-info">
Change password
{% trans "ChangePasswordBtn" %}
</a>
</div>
{% endifequal %}
<div>
<p>Username: {{ user_obj.username }}</p>
<p>Имя: {{ user_obj.first_name }}</p>
<p>Фамилия: {{ user_obj.last_name }}</p>
<p>Дата рождения: {{ user_obj.profile.birth_date }}</p>
<p>Пол: {{ user_obj.profile.gender }}</p>
<p>Номер телефона: {{ user_obj.profile.phone_number }}</p>
<p>Почта: {{ user_obj.email }}</p>
<p>{% trans "FirstName" %}: {{ user_obj.first_name }}</p>
<p>{% trans "LastName" %}: {{ user_obj.last_name }}</p>
<p>{% trans "BirthDate" %}: {{ user_obj.profile.birth_date }}</p>
<p>{% trans "Gender" %}: {{ user_obj.profile.gender }}</p>
<p>{% trans "PhoneNumber" %}: {{ user_obj.profile.phone_number }}</p>
<p>{% trans "Email" %}: {{ user_obj.email }}</p>
</div>
......
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-01 18:26+0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: accounts/models.py:7 accounts/templates/user_detail.html:23
msgid "Gender"
msgstr ""
#: accounts/models.py:15
msgid "User"
msgstr "User"
#: accounts/models.py:17 accounts/templates/user_detail.html:22
msgid "BirthDate"
msgstr "Birth Date"
#: accounts/models.py:19 accounts/templates/user_detail.html:24
msgid "PhoneNumber"
msgstr "Phone Number"
#: accounts/models.py:21
msgid "GenderUser"
msgstr "Gender User"
#: accounts/templates/change_password.html:8
msgid "ChangePasswordTitle"
msgstr "Change Password"
#: accounts/templates/change_password.html:12
#: accounts/templates/user_detail.html:14
msgid "ChangePasswordBtn"
msgstr "Change Password"
#: accounts/templates/edit_profile.html:8
msgid "EditProfileTitle"
msgstr "Edit Profile"
#: accounts/templates/edit_profile.html:16
#: accounts/templates/user_detail.html:11
msgid "EditProfileBtn"
msgstr "Edit Profile"
#: accounts/templates/registration/login.html:8
msgid "loginTitle"
msgstr "Login"
#: accounts/templates/registration/login.html:12
msgid "WrongMessLoginPassword"
msgstr "Login or password error"
#: accounts/templates/registration/login.html:14
msgid "Username"
msgstr "Username"
#: accounts/templates/registration/login.html:15
msgid "Password"
msgstr "Password"
#: accounts/templates/registration/login.html:17
msgid "LoginBtn"
msgstr "Login"
#: accounts/templates/registration/register.html:12
msgid "RegistrationBtn"
msgstr "Registration"
#: accounts/templates/user_detail.html:7
msgid "ProfileTitle"
msgstr "Profile"
#: accounts/templates/user_detail.html:20
msgid "FirstName"
msgstr "First Name"
#: accounts/templates/user_detail.html:21
msgid "LastName"
msgstr "Last Name"
#: accounts/templates/user_detail.html:25
msgid "Email"
msgstr "Email"
#: speed_dating/settings.py:130
msgid "English"
msgstr "English"
#: speed_dating/settings.py:131
msgid "Russian"
msgstr "Russian"
#: speed_dating/settings.py:132
msgid "Kazakh"
msgstr "Kazakh"
#: webapp/models.py:7
msgid "NameRestaurant"
msgstr "Name Restaurant"
#: webapp/models.py:9
msgid "AddressRestaurant"
msgstr "Address Restaurant"
#: webapp/models.py:11
msgid "PhotoRestaurant"
msgstr "Photo Restaurant"
#: webapp/models.py:13
msgid "DescriptionRestaurant"
msgstr "Description Restaurant"
#: webapp/models.py:21
msgid "PlaceEvent"
msgstr "Place Event"
#: webapp/models.py:23
msgid "DateEvent"
msgstr "Date Event"
#: webapp/models.py:25
msgid "ParticipantsEvent"
msgstr "Participants Event"
#: webapp/templates/all_user_in_event.html:7
msgid "ParticipantsList"
msgstr "Participants List"
#: webapp/templates/all_user_in_event.html:14
#: webapp/templates/event_detail.html:41
msgid "BackBtn"
msgstr "Back"
#: webapp/templates/base.html:17
msgid "Home"
msgstr "Speed Dating"
#: webapp/templates/base.html:25
msgid "Events"
msgstr "Events"
#: webapp/templates/base.html:30
msgid "CreateEvent"
msgstr "Create Event"
#: webapp/templates/base.html:37
msgid "logout"
msgstr "logout"
#: webapp/templates/base.html:41
msgid "Hello"
msgstr "Hello"
#: webapp/templates/base.html:46
msgid "Login"
msgstr "Login"
#: webapp/templates/base.html:50
msgid "Registration"
msgstr "Registration"
#: webapp/templates/event_create.html:8
msgid "CreateEventTitle"
msgstr "Create Event"
#: webapp/templates/event_create.html:12
msgid "CreateBtn"
msgstr "Create"
#: webapp/templates/event_delete.html:7
msgid "DeleteTitle"
msgstr "Delete"
#: webapp/templates/event_delete.html:8 webapp/templates/participate.html:8
msgid "CancelBtn"
msgstr "Cancel"
#: webapp/templates/event_delete.html:11 webapp/templates/participate.html:11
msgid "YesBtn"
msgstr "Yes"
#: webapp/templates/event_detail.html:21
msgid "UpdateBtn"
msgstr "Update"
#: webapp/templates/event_detail.html:24
msgid "DeleteBtn"
msgstr "Delete"
#: webapp/templates/event_detail.html:28
msgid "YouAreAlreadyParticipatingInThisEvent"
msgstr "You Are Already Participating In This Event"
#: webapp/templates/event_detail.html:31
msgid "ParticipateBtn"
msgstr "Participate"
#: webapp/templates/event_detail.html:33
msgid "YouNeedTtoFillOutYourProfile"
msgstr "You need to fill out your profile. Click on your login, which is located at the top"
#: webapp/templates/event_detail.html:37
msgid "ParticipateListBtn"
msgstr "Participate List"
#: webapp/templates/event_list.html:7
msgid "EventsListTitle"
msgstr "Events List"
#: webapp/templates/event_update.html:8
msgid "UpdateEventTitle"
msgstr "Update Event"
#: webapp/templates/event_update.html:12
msgid "ChangeBtn"
msgstr "Change"
#: webapp/templates/index.html:24
msgid "WhatIsSpeedDating?"
msgstr "What Is Speed Dating?"
#: webapp/templates/index.html:26
msgid "LongTextIndex"
msgstr "Participants, as a rule, are selected according to equal social groups. Some organizers are introducing age restrictions. At a classic speed dating party, each participant will have 10-15 private meetings with members of the opposite sex. The girls are seated at tables with numbers. Every 3–7 minutes, men are sequentially transplanted from one girl to another. After each meeting, guests mark their impressions of the interlocutor in the sympathy card or directly exchange contacts. Next, the organizers compare the sympathy cards, and in case of a match +, send contacts to participants."
#: webapp/templates/participate.html:7
msgid "ParticipateInTheEvent"
msgstr "Participate In The Event"
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-01 18:26+0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: accounts/models.py:7 accounts/templates/user_detail.html:23
msgid "Gender"
msgstr "Жыныс"
#: accounts/models.py:15
msgid "User"
msgstr "Пайдаланушы"
#: accounts/models.py:17 accounts/templates/user_detail.html:22
msgid "BirthDate"
msgstr "Туган кунi"
#: accounts/models.py:19 accounts/templates/user_detail.html:24
msgid "PhoneNumber"
msgstr "Телефон нөмірі"
#: accounts/models.py:21
msgid "GenderUser"
msgstr "Пайдаланушы жынысы"
#: accounts/templates/change_password.html:8
msgid "ChangePasswordTitle"
msgstr "құпия сөзді өзгерту"
#: accounts/templates/change_password.html:12
#: accounts/templates/user_detail.html:14
msgid "ChangePasswordBtn"
msgstr "құпия сөзді өзгерту"
#: accounts/templates/edit_profile.html:8
msgid "EditProfileTitle"
msgstr "профильді өзгерту"
#: accounts/templates/edit_profile.html:16
#: accounts/templates/user_detail.html:11
msgid "EditProfileBtn"
msgstr "профильді өзгерту"
#: accounts/templates/registration/login.html:8
msgid "loginTitle"
msgstr "Киру"
#: accounts/templates/registration/login.html:12
msgid "WrongMessLoginPassword"
msgstr "Логин немесе құпия сөзді енгізу қатесі"
#: accounts/templates/registration/login.html:14
msgid "Username"
msgstr "Қолданушының аты"
#: accounts/templates/registration/login.html:15
msgid "Password"
msgstr "құпия сөз"
#: accounts/templates/registration/login.html:17
msgid "LoginBtn"
msgstr "Киру"
#: accounts/templates/registration/register.html:12
msgid "RegistrationBtn"
msgstr "Тіркеу"
#: accounts/templates/user_detail.html:7
msgid "ProfileTitle"
msgstr "Профиль"
#: accounts/templates/user_detail.html:20
msgid "FirstName"
msgstr "Аты"
#: accounts/templates/user_detail.html:21
msgid "LastName"
msgstr "Тегі"
#: accounts/templates/user_detail.html:25
msgid "Email"
msgstr "Пошта"
#: speed_dating/settings.py:130
msgid "English"
msgstr "Ағылшын"
#: speed_dating/settings.py:131
msgid "Russian"
msgstr "Орыс"
#: speed_dating/settings.py:132
msgid "Kazakh"
msgstr "Казак"
#: webapp/models.py:7
msgid "NameRestaurant"
msgstr "Мекеменің атауы"
#: webapp/models.py:9
msgid "AddressRestaurant"
msgstr "Мекеме мекенжайы"
#: webapp/models.py:11
msgid "PhotoRestaurant"
msgstr "Мекеменің фотосы"
#: webapp/models.py:13
msgid "DescriptionRestaurant"
msgstr "Мекеменің сипаттамасы"
#: webapp/models.py:21
msgid "PlaceEvent"
msgstr "Іс-шараның өтетін орны"
#: webapp/models.py:23
msgid "DateEvent"
msgstr "Оқиға күні"
#: webapp/models.py:25
msgid "ParticipantsEvent"
msgstr "Қатысу және іс-шаралар"
#: webapp/templates/all_user_in_event.html:7
msgid "ParticipantsList"
msgstr "Қатысушылар"
#: webapp/templates/all_user_in_event.html:14
#: webapp/templates/event_detail.html:41
msgid "BackBtn"
msgstr "Артқа"
#: webapp/templates/base.html:17
msgid "Home"
msgstr "Speed Dating"
#: webapp/templates/base.html:25
msgid "Events"
msgstr "Белсенділік"
#: webapp/templates/base.html:30
msgid "CreateEvent"
msgstr "Оқиға жасау"
#: webapp/templates/base.html:37
msgid "logout"
msgstr "Шығу"
#: webapp/templates/base.html:41
msgid "Hello"
msgstr "Салем"
#: webapp/templates/base.html:46
msgid "Login"
msgstr "Киру"
#: webapp/templates/base.html:50
msgid "Registration"
msgstr "Тіркеу"
#: webapp/templates/event_create.html:8
msgid "CreateEventTitle"
msgstr "Оқиға жасау"
#: webapp/templates/event_create.html:12
msgid "CreateBtn"
msgstr "Жасау"
#: webapp/templates/event_delete.html:7
msgid "DeleteTitle"
msgstr "Жою"
#: webapp/templates/event_delete.html:8 webapp/templates/participate.html:8
msgid "CancelBtn"
msgstr "Болдырмау"
#: webapp/templates/event_delete.html:11 webapp/templates/participate.html:11
msgid "YesBtn"
msgstr "Ия"
#: webapp/templates/event_detail.html:21
msgid "UpdateBtn"
msgstr "Өңдеу"
#: webapp/templates/event_detail.html:24
msgid "DeleteBtn"
msgstr "Жою"
#: webapp/templates/event_detail.html:28
msgid "YouAreAlreadyParticipatingInThisEvent"
msgstr "Сіз бұл іс-шараға қатысып жатырсыз"
#: webapp/templates/event_detail.html:31
msgid "ParticipateBtn"
msgstr "Қатысу"
#: webapp/templates/event_detail.html:33
msgid "YouNeedTtoFillOutYourProfile"
msgstr "Сіз профиліңізді толтыруыңыз керек. Жоғарғы жағында орналасқан логиніңізді басыңыз"
#: webapp/templates/event_detail.html:37
msgid "ParticipateListBtn"
msgstr "Қатысушылар тізімі"
#: webapp/templates/event_list.html:7
msgid "EventsListTitle"
msgstr "Оқиғалар тізімі"
#: webapp/templates/event_update.html:8
msgid "UpdateEventTitle"
msgstr "Оқиғаларды өңдеу"
#: webapp/templates/event_update.html:12
msgid "ChangeBtn"
msgstr "Өзгерту"
#: webapp/templates/index.html:24
msgid "WhatIsSpeedDating?"
msgstr "Жылдам танысу дегеніміз не"
#: webapp/templates/index.html:26
msgid "LongTextIndex"
msgstr "Қатысушылар, әдетте, тең әлеуметтік топтарға сәйкес таңдалады. Кейбір ұйымдастырушылар жас шектеулерін қояды. Классикалық жылдамдықтағы кездесу кешінде әрбір қатысушы қарама-қарсы жыныстың өкілдерімен оңаша 10-15 кездесу өткізеді. Қыздар сандар жазылған үстелдерге отырады. Әр 3-7 минут сайын ер адамдар бір қыздан екіншісіне кезекпен ауыстырылады. Әрбір кездесуден кейін қонақтар сұхбаттасушы туралы алған әсерлерін «көзайым картасына» белгілейді немесе тікелей байланыстар алмасады. Содан кейін ұйымдастырушылар «көзайым карталарын» салыстырады, егер «+» сәйкестік болса, қатысушыларға контактілерді жібереді."
#: webapp/templates/participate.html:7
msgid "ParticipateInTheEvent"
msgstr "Іс-шараға қатысыңыз"
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-01 18:26+0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n"
"%100>=11 && n%100<=14)? 2 : 3);\n"
#: accounts/models.py:7 accounts/templates/user_detail.html:23
msgid "Gender"
msgstr "Пол"
#: accounts/models.py:15
msgid "User"
msgstr "Пользователь"
#: accounts/models.py:17 accounts/templates/user_detail.html:22
msgid "BirthDate"
msgstr "Дата рождения"
#: accounts/models.py:19 accounts/templates/user_detail.html:24
msgid "PhoneNumber"
msgstr "Номер телефона"
#: accounts/models.py:21
msgid "GenderUser"
msgstr "Пол пользователя"
#: accounts/templates/change_password.html:8
msgid "ChangePasswordTitle"
msgstr "Сменить пароль"
#: accounts/templates/change_password.html:12
#: accounts/templates/user_detail.html:14
msgid "ChangePasswordBtn"
msgstr "Сменить пароль"
#: accounts/templates/edit_profile.html:8
msgid "EditProfileTitle"
msgstr "Изменить профайл"
#: accounts/templates/edit_profile.html:16
#: accounts/templates/user_detail.html:11
msgid "EditProfileBtn"
msgstr "Изменить профайл"
#: accounts/templates/registration/login.html:8
msgid "loginTitle"
msgstr "Вход"
#: accounts/templates/registration/login.html:12
msgid "WrongMessLoginPassword"
msgstr "Ошибка ввода логина или пароля"
#: accounts/templates/registration/login.html:14
msgid "Username"
msgstr "Логин"
#: accounts/templates/registration/login.html:15
msgid "Password"
msgstr "Пароль"
#: accounts/templates/registration/login.html:17
msgid "LoginBtn"
msgstr "Вход"
#: accounts/templates/registration/register.html:12
msgid "RegistrationBtn"
msgstr "Регистрация"
#: accounts/templates/user_detail.html:7
msgid "ProfileTitle"
msgstr "Профиль"
#: accounts/templates/user_detail.html:20
msgid "FirstName"
msgstr "Имя"
#: accounts/templates/user_detail.html:21
msgid "LastName"
msgstr "Фамилия"
#: accounts/templates/user_detail.html:25
msgid "Email"
msgstr "Почта"
#: speed_dating/settings.py:130
msgid "English"
msgstr "Английский"
#: speed_dating/settings.py:131
msgid "Russian"
msgstr "Русский"
#: speed_dating/settings.py:132
msgid "Kazakh"
msgstr "Казахский"
#: webapp/models.py:7
msgid "NameRestaurant"
msgstr "Название заведения"
#: webapp/models.py:9
msgid "AddressRestaurant"
msgstr "Адрес заведения"
#: webapp/models.py:11
msgid "PhotoRestaurant"
msgstr "Фото заведения"
#: webapp/models.py:13
msgid "DescriptionRestaurant"
msgstr "Описание заведения"
#: webapp/models.py:21
msgid "PlaceEvent"
msgstr "Место мероприятия"
#: webapp/models.py:23
msgid "DateEvent"
msgstr "Дата мероприятия"
#: webapp/models.py:25
msgid "ParticipantsEvent"
msgstr "Участники мероприятия"
#: webapp/templates/all_user_in_event.html:7
msgid "ParticipantsList"
msgstr "Список участников"
#: webapp/templates/all_user_in_event.html:14
#: webapp/templates/event_detail.html:41
msgid "BackBtn"
msgstr "Назад"
#: webapp/templates/base.html:17
msgid "Home"
msgstr "Speed Dating"
#: webapp/templates/base.html:25
msgid "Events"
msgstr "Мероприятия"
#: webapp/templates/base.html:30
msgid "CreateEvent"
msgstr "Создать мероприятие"
#: webapp/templates/base.html:37
msgid "logout"
msgstr "Выход"
#: webapp/templates/base.html:41
msgid "Hello"
msgstr "Привет"
#: webapp/templates/base.html:46
msgid "Login"
msgstr "Вход"
#: webapp/templates/base.html:50
msgid "Registration"
msgstr "Регистрация"
#: webapp/templates/event_create.html:8
msgid "CreateEventTitle"
msgstr "Создать мероприятие"
#: webapp/templates/event_create.html:12
msgid "CreateBtn"
msgstr "Создать"
#: webapp/templates/event_delete.html:7
msgid "DeleteTitle"
msgstr "Удалить"
#: webapp/templates/event_delete.html:8 webapp/templates/participate.html:8
msgid "CancelBtn"
msgstr "Отмена"
#: webapp/templates/event_delete.html:11 webapp/templates/participate.html:11
msgid "YesBtn"
msgstr "Да"
#: webapp/templates/event_detail.html:21
msgid "UpdateBtn"
msgstr "Редактировать"
#: webapp/templates/event_detail.html:24
msgid "DeleteBtn"
msgstr "Удалить"
#: webapp/templates/event_detail.html:28
msgid "YouAreAlreadyParticipatingInThisEvent"
msgstr "Вы уже участвуете в данном мероприятии"
#: webapp/templates/event_detail.html:31
msgid "ParticipateBtn"
msgstr "Участники"
#: webapp/templates/event_detail.html:33
msgid "YouNeedTtoFillOutYourProfile"
msgstr "Вам необходимо заполнить Ваш профиль. Нажмите на Ваш логин, который размещен сверху."
#: webapp/templates/event_detail.html:37
msgid "ParticipateListBtn"
msgstr "Список участников"
#: webapp/templates/event_list.html:7
msgid "EventsListTitle"
msgstr "Список мероприятий"
#: webapp/templates/event_update.html:8
msgid "UpdateEventTitle"
msgstr "Редактировать мероприятие"
#: webapp/templates/event_update.html:12
msgid "ChangeBtn"
msgstr "Изменить"
#: webapp/templates/index.html:24
msgid "WhatIsSpeedDating?"
msgstr "Что такое Speed Dating"
#: webapp/templates/index.html:26
msgid "LongTextIndex"
msgstr "Участников, как правило, подбирают по равноценным социальным группам. Некоторые организаторы вводят возрастные ограничения. На классической спид-дейтинг-вечеринке каждый участник будет иметь 10–15 встреч наедине с представителями противоположного пола. Девушки размещаются за столиками с номерами. Мужчины через каждые 3–7 минут последовательно пересаживаются от одной девушки к другой. После каждой встречи гости отмечают свои впечатления о собеседнике в «карте симпатий» или напрямую обмениваются контактами. Далее организаторы сравнивают «карты симпатий», и, в случае совпадения «+», рассылают контакты участникам."
#: webapp/templates/participate.html:7
msgid "ParticipateInTheEvent"
msgstr "Участвовать в мероприятии"
......@@ -13,6 +13,8 @@ import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
from django.utils.translation import gettext_lazy as _
BASE_DIR = Path(__file__).resolve().parent.parent
......@@ -31,6 +33,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'modeltranslation',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
......@@ -45,6 +48,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
......@@ -106,7 +110,32 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
EXTRA_LANG_INFO = {
"kz": {
"bidi": False,
"code": "kz",
"name": "Kazakh",
"name_local": "Qazaq"
}
}
import django.conf.locale
django.conf.locale.LANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)
LANGUAGE_CODE = 'ru'
LANGUAGES = [
("en", _("English")),
("ru", _("Russian")),
("kz", _("Kazakh"))
]
LOCALE_PATHS = [
os.path.join(BASE_DIR, "locales")
]
TIME_ZONE = 'Asia/Almaty'
......
......@@ -14,6 +14,7 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
......@@ -22,6 +23,9 @@ from accounts import views as accounts_views
urlpatterns = [
path('admin/', admin.site.urls),
]
urlpatterns += i18n_patterns(
path('login/', accounts_views.LoginView.as_view(), name="login"),
path('logout/', accounts_views.LogoutView.as_view(), name="logout"),
path('create/', accounts_views.RegisterView.as_view(), name="register"),
......@@ -35,5 +39,9 @@ urlpatterns = [
path("events/<int:pk>/add-user/", webapp_views.ParticipateView.as_view(), name="add_user"),
path("events/<int:pk>/edit/", webapp_views.EventUpdateView.as_view(), name="update_events"),
path("events/<int:pk>/delete/", webapp_views.EventDeleteView.as_view(), name="delete_events"),
path("events/<int:pk>/view-all-users", webapp_views.ParticipateListInEventView.as_view(), name="list_users_in_event")
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
path("events/<int:pk>/view-all-users", webapp_views.ParticipateListInEventView.as_view(),
name="list_users_in_event")
)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import User
from django.db import models
class Restaurant(models.Model):
name = models.CharField(max_length=30, verbose_name="Название заведения")
name = models.CharField(max_length=30, verbose_name=_("NameRestaurant"))
address = models.CharField(max_length=70, verbose_name="Адрес")
address = models.CharField(max_length=70, verbose_name=_("AddressRestaurant"))
photo = models.ImageField(upload_to="photo", default=1, verbose_name="Фото заведения")
photo = models.ImageField(upload_to="photo", default=1, verbose_name=_("PhotoRestaurant"))
description = models.TextField(max_length=1000, verbose_name="Описание заведения")
description = models.TextField(max_length=1000, verbose_name=_("DescriptionRestaurant"))
def __str__(self):
return f'{self.name}'
......@@ -17,11 +18,11 @@ class Restaurant(models.Model):
class Event(models.Model):
place = models.ForeignKey(Restaurant, on_delete=models.CASCADE,
verbose_name="Место проведения", related_name="Place")
verbose_name=_("PlaceEvent"), related_name="Place")
date = models.DateTimeField(verbose_name="Дата")
date = models.DateTimeField(verbose_name=_("DateEvent"))
users = models.ManyToManyField(User, blank=True, related_name="participants")
users = models.ManyToManyField(User, blank=True, verbose_name=_("ParticipantsEvent"), related_name="participants")
def __str__(self):
return f'{self.place} - {self.date}'
......
{% extends "base.html" %}
{% load i18n %}
{% block title %}Список участников{% endblock %}
{% block content %}
<h1>Список участников</h1>
<h1>{% trans "ParticipantsList" %}</h1>
<p>
{% for u in event.users.all %}
<a href="{% url "profile" u.pk %}">{{ u }}</a>
<br>
{% endfor %}
</p>
<a href="{% url "detail_events" event.pk %}" class="mt-3 btn btn-info">Назад</a>
<a href="{% url "detail_events" event.pk %}" class="mt-3 btn btn-info">{% trans "BackBtn" %}</a>
{% endblock %}
\ No newline at end of file
{% load i18n %}
<!doctype html>
<html lang="en">
<head>
......@@ -8,11 +10,12 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="{% url 'index' %}">Speed Dating</a>
<a class="navbar-brand" href="{% url 'index' %}">{% trans "Home" %}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
......@@ -20,38 +23,58 @@
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="{% url 'list_events' %}">Мероприятия<span class="sr-only">(current)</span></a>
<a class="nav-link" href="{% url 'list_events' %}">{% trans "Events" %}<span
class="sr-only">(current)</span></a>
</li>
{% if perms.webapp.add_event %}
<li class="nav-item">
<a class="nav-link" href="{% url 'create_events' %}">Создать мероприятие</a>
<a class="nav-link" href="{% url 'create_events' %}">{% trans "CreateEvent" %}</a>
</li>
{% endif %}
{% if user.is_authenticated %}
<li class="nav-item">
<form action="{% url "logout" %}" method="post">
{% csrf_token %}
<button class="btn btn-sm btn-primary">Выйти</button>
<button class="btn btn-sm btn-primary">{% trans "logout" %}</button>
</form>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url "profile" user.pk %}">Привет, {{ user.username }}</a>
<a class="nav-link" href="{% url "profile" user.pk %}">{% trans "Hello" %}, {{ user.username }}</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url "login" %}?next={{ request.get_full_path }}">Войти</a>
<a class="nav-link"
href="{% url "login" %}?next={{ request.get_full_path }}">{% trans "Login" %}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url "register" %}?next={{ request.get_full_path }}">Регистрация</a>
<a class="nav-link"
href="{% url "register" %}?next={{ request.get_full_path }}">{% trans "Registration" %}</a>
</li>
{% endif %}
<li class="nav-item dropdown">
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% get_language_info for LANGUAGE_CODE as current_language %}
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
{{ current_language.name_local }}
</a>
<div class="dropdown-menu">
{% for language in languages %}
<a href="/{{ language.code }}" class="dropdown-item">
{{ language.name_local }}({{ language.code }})
</a>
{% endfor %}
</div>
</li>
</ul>
</div>
</nav>
<div class="container">
{% block content %}{% endblock %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load i18n %}
{% block title %}Create Event{% endblock %}
{% block content %}
<h1>Создать Мероприятие</h1>
<h1>{% trans "CreateEventTitle" %}</h1>
<form action="{% url "create_events" %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form|crispy }}
<button>Создать</button>
<button>{% trans "CreateBtn" %}</button>
</form>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% load i18n %}
{% block title %}Delete {{ event.place }}{% endblock %}
{% block content %}
<h2>Удалить "{{ event.place }}"</h2>
<a href="{% url "list_events" %}">Cancel</a>
<h2>{% trans "DeleteTitle" %} "{{ event.place }}"</h2>
<a href="{% url "list_events" %}">{% trans "CancelBtn" %}</a>
<form action="{% url "delete_events" event.pk %}" method="post">
{% csrf_token %}
<button>Yes</button>
<button>{% trans "YesBtn" %}</button>
</form>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load i18n %}
{% block title %}Events{% endblock %}
......@@ -17,27 +18,27 @@
<p class="mt-5">{{ event.date|date:"M d Y - H:i" }}</p>
{% if perms.webapp.change_event %}
<a href="{% url "update_events" event.pk %}" class="btn btn-info">Редактировать</a>
<a href="{% url "update_events" event.pk %}" class="btn btn-info">{% trans "UpdateBtn" %}</a>
{% endif %}
{% if perms.webapp.delete_event %}
<a href="{% url "delete_events" event.pk %}" class="ml-5 btn btn-info">Удалить</a>
<a href="{% url "delete_events" event.pk %}" class="ml-5 btn btn-info">{% trans "DeleteBtn" %}</a>
{% endif %}
<div class="mt-3">
{% if user in event.users.all %}
<p>Вы уже участвуете в данном мероприятии</p>
<p>{% trans "YouAreAlreadyParticipatingInThisEvent" %}</p>
{% else %}
{% if user.profile.gender and user.profile.birth_date and user.profile.phone_number %}
<a href="{% url "add_user" event.pk %}" class="btn btn-info mb-3">Участвовать</a>
<a href="{% url "add_user" event.pk %}" class="btn btn-info mb-3">{% trans "ParticipateBtn" %}</a>
{% else %}
<p>Вам необходимо заполнить Ваш профиль. Нажмите на Ваш логин, который размещен сверху</p>
<p>{% trans "YouNeedTtoFillOutYourProfile" %}</p>
{% endif %}
{% endif %}
{% if perms.webapp.can_see_all_user_in_event %}
<a href="{% url "list_users_in_event" event.pk %}" class="mb-3 btn btn-info">Посмотреть список участников</a>
<a href="{% url "list_users_in_event" event.pk %}" class="mb-3 btn btn-info">{% trans "ParticipateListBtn" %}</a>
{% endif %}
</div>
<a href="{% url "list_events" %}" class="btn btn-info">Назад</a>
<a href="{% url "list_events" %}" class="btn btn-info">{% trans "BackBtn" %}</a>
</div>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load i18n %}
{% block title %}Events{% endblock %}
{% block content %}
<h1 class="mt-5">Список мероприятий</h1>
<h1 class="mt-5">{% trans "EventsListTitle" %}</h1>
{% for event in events %}
<div class="mt-5">
<a href="{% url 'detail_events' event.pk %}">{{ event.place }} - {{ event.place.address }}</a>
......
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load i18n %}
{% block title %}Update Event{% endblock %}
{% block content %}
<h1>Редактировать Мероприятие</h1>
<h1>{% trans "UpdateEventTitle" %}</h1>
<form action="{% url "update_events" event.pk %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form|crispy }}
<button>Редактировать</button>
<button>{% trans "ChangeBtn" %}</button>
</form>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load i18n %}
{% block title %}Home{% endblock %}
......@@ -20,15 +21,9 @@
</div>
</div>
<div>
<h1 class="mt-5">Что такое Speed Dating?</h1>
<h1 class="mt-5">{% trans "WhatIsSpeedDating?" %}</h1>
<p class="mt-5">
Участников, как правило, подбирают по равноценным социальным группам. Некоторые организаторы вводят
возрастные ограничения. На классической спид-дейтинг-вечеринке каждый участник будет иметь 10–15
встреч наедине с представителями противоположного пола. Девушки размещаются за столиками с номерами.
Мужчины через каждые 3–7 минут последовательно пересаживаются от одной девушки к другой. После каждой
встречи гости отмечают свои впечатления о собеседнике в «карте симпатий» или напрямую обмениваются
контактами. Далее организаторы сравнивают «карты симпатий», и, в случае совпадения «+»,
рассылают контакты участникам.
{% trans "LongTextIndex" %}
</p>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% load i18n %}
{% block title %}Участие {{ event.place }}{% endblock %}
{% block content %}
<h2>Участвовать в мероприятии "{{ event.place }}"</h2>
<a href="{% url "list_events" %}">Cancel</a>
<h2>{% trans "ParticipateInTheEvent" %} "{{ event.place }}"</h2>
<a href="{% url "list_events" %}">{% trans "CancelBtn" %}</a>
<form action="{% url "add_user" event.pk %}" method="post">
{% csrf_token %}
<button>Yes</button>
<button>{% trans "YesBtn" %}</button>
</form>
{% endblock %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment