Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added users app and configured user registration and authorization by… #22

Merged
merged 4 commits into from
Feb 13, 2024

Conversation

ArtemKAF
Copy link
Contributor

@ArtemKAF ArtemKAF commented Feb 9, 2024

Создал приложение users и настроил регистрацию и авторизацию пользователя по email.

Copy link
Contributor

@shoxxd221 shoxxd221 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings/base.py 53 строка, наверное просто забыл убрать
print(BASE_DIR)

@ArtemKAF
Copy link
Contributor Author

settings/base.py 53 строка, наверное просто забыл убрать print(BASE_DIR)

Спасибо, что заметил. Заодно добавил аннотации типов в паре мест.

return email


class User(CreatedModifiedFields, AbstractUser):
Copy link
Contributor

@shoxxd221 shoxxd221 Feb 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для этой модели не нужно прописывать def __str__?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этот метод присутствует в родительском классе.

def get_short_name(self) -> str:
"""Метод получения сокращенного имени пользователя."""

return self.username
Copy link
Contributor

@shoxxd221 shoxxd221 Feb 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не понимаю, для чего две функции возвращают одно и то же значение, если можно просто условиться использовать либо переписанный get_full_name, либо get_short_name. Или почему просто не использовать get_username?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В родительском классе присутствуют и без переопределения они бы пытались получить значение полей first_name и last_name, которые отключены в этой модели.

@ArtemKAF ArtemKAF linked an issue Feb 13, 2024 that may be closed by this pull request
2 tasks
@ArtemKAF ArtemKAF merged commit 9b2b4e8 into develop Feb 13, 2024
1 check passed
@ArtemKAF ArtemKAF deleted the feature/users_app branch February 13, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants