Skip to content

Commit

Permalink
Шаблоны перенесены в приложение users.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeWazowskyi committed Sep 1, 2023
1 parent 0f29187 commit 25efb2b
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 9 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ help: # Show help


.PHONY: runbot-init
runbot-init: deletedb rundb migrate filldb runbot-db # Build and run Database Docker-image
runbot-init: deletedb rundb migrate filldb create_superuser runbot-db # Build and run Database Docker-image
@echo -e "$(COLOR_YELLOW)Starting initialization...$(COLOR_RESET)"
@source $$(poetry env info -p)/bin/activate

Expand Down Expand Up @@ -99,7 +99,12 @@ run_tests: run_unit_tests # Run all tests
.PHONY: run_unit_tests
run_unit_tests: # Run unit tests
@echo -e "$(COLOR_YELLOW)Start unit tests...$(COLOR_RESET)"
@cd src
@poetry run pytest src/tests/unit
@cd ..
@echo -e "$(COLOR_GREEN)Unit tests passed$(COLOR_RESET)"


.PHONY: create_superuser
create_superuser: # Run unit tests
@echo -e "$(COLOR_YELLOW)Creating superuser...$(COLOR_RESET)"
@poetry run python src/manage.py initadmin
@echo -e "$(COLOR_GREEN)Superuser created$(COLOR_RESET)"
2 changes: 1 addition & 1 deletion src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
DEFAULT_RECEIVER = env.str("DEFAULT_EMAIL_ADDRESS")

OTP_EMAIL_SENDER = EMAIL_HOST_USER
OTP_EMAIL_BODY_HTML_TEMPLATE_PATH = "users/emailing/otp_email.html"
OTP_EMAIL_BODY_HTML_TEMPLATE_PATH = "emailing/otp_email.html"

# Telegram bot settings
TELEGRAM_TOKEN = env.str("TELEGRAM_TOKEN")
Expand Down
2 changes: 1 addition & 1 deletion src/users/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ class CustomOTPAdminSite(OTPAdminSite):
"""Customized admin site."""

login_form = CustomOTPAuthenticationForm
login_template = "users/authentication/login.html"
login_template = "authentication/login.html"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "users/emailing/email.html" %}
{% extends "emailing/email.html" %}
{% block subject %}Одноразовый код для доступа админ-панели "Расправь Крылья"{% endblock %}
{% block content %}
<div align="center">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "users/emailing/email.html" %}
{% extends "emailing/email.html" %}
{% block subject %}Доступ к админ-панели бота фонда "Расправь Крылья"{% endblock %}
{% block content %}
<div align="center">
Expand Down
2 changes: 1 addition & 1 deletion src/users/utils/emailing/reset_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def send_password_reset_email(instance: User, message=None, template=None):
"""Send email with password reset link."""
if template is None:
template = "users/emailing/password_reset_email.html"
template = "emailing/password_reset_email.html"
reset_link = get_password_reset_link(instance)
email = render_email_message(
subject='Доступ к админ-панели бота "Расправь крылья"',
Expand Down
2 changes: 1 addition & 1 deletion src/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class PasswordSetView(PasswordResetConfirmView):
"""User password reset view."""

success_url = reverse_lazy("admin:index")
template_name = "password_set_confirm.html"
template_name = "authentication/password_set_confirm.html"

def form_valid(self, form):
"""Set user satus as active if password was changed."""
Expand Down

0 comments on commit 25efb2b

Please sign in to comment.