Skip to content

Commit

Permalink
Fix black, isort and flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodiegoss committed Nov 21, 2024
1 parent 879cf07 commit 48c7c89
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 49 deletions.
6 changes: 3 additions & 3 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.utils.translation import gettext_lazy as _
from sentry_sdk.integrations.django import DjangoIntegration

from .storage_settings import * # noqa F403 F401
from .storage_settings import * # noqa F403 F401

ROOT_DIR = environ.Path("/jandig/")
BASE_DIR = "/jandig/src"
Expand Down Expand Up @@ -196,10 +196,10 @@ def debug(request):


DEFAULT_FROM_EMAIL = env("SMTP_SENDER_MAIL", default="[email protected]")
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = env("SMTP_SERVER", default="mailpit")
EMAIL_USE_TLS = env("SMTP_USE_TLS", default=False)
EMAIL_PORT = env("SMTP_PORT", default=1025)
EMAIL_PORT = env("SMTP_PORT", default=1025)
EMAIL_HOST_USER = env("SMTP_USER", default="[email protected]")
EMAIL_HOST_PASSWORD = env("SMTP_PASSWORD", default="password")
EMAIL_USE_SSL = False
Expand Down
9 changes: 6 additions & 3 deletions src/core/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from django.conf import settings
from django.urls import include, path
from django.urls import include, path, re_path
from rest_framework_nested.routers import DefaultRouter

from core.views.artworks import ArtworkViewset
from core.views.exhibits import ExhibitViewset
from core.views.markers import MarkerViewset
from core.views.objects import ObjectViewset
from django.urls import re_path
from core.views.static_views import (
community,
documentation,
Expand Down Expand Up @@ -48,7 +47,11 @@
path("manifest.json", manifest, name="manifest"),
path("upload", upload_image, name="upload-image"),
path("i18n/", include("django.conf.urls.i18n")),
re_path(r"^see_all(?:/(?P<which>[a-zA-Z]+))?(?:/(?P<page>\d+))?/$", see_all, name="see_all"),
re_path(
r"^see_all(?:/(?P<which>[a-zA-Z]+))?(?:/(?P<page>\d+))?/$",
see_all,
name="see_all",
),
path("robots.txt", robots_txt),
path("favicon.ico", favicon),
path(settings.HEALTH_CHECK_URL, health_check),
Expand Down
2 changes: 1 addition & 1 deletion src/core/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def see_all(request, which="", page=1):
if data:
paginator = Paginator(data, per_page)
if page > paginator.num_pages:
return redirect("see_all", request_type,paginator.num_pages)
return redirect("see_all", request_type, paginator.num_pages)
paginated_data = paginator.get_page(page)
paginated_data.adjusted_elided_pages = paginator.get_elided_page_range(page)
ctx = {
Expand Down
2 changes: 1 addition & 1 deletion src/users/services/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .recaptcha_service import *
from .recaptcha_service import * # noqa
42 changes: 16 additions & 26 deletions src/users/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from .forms import LoginForm
from .views import (
ResetPasswordView,
create_artwork,
create_exhibit,
delete,
Expand All @@ -14,20 +15,14 @@
edit_password,
edit_profile,
element_get,
invalid_recovering_email_or_username,
marker_upload,
mod,
mod_delete,
object_upload,
permission_denied,
profile,
recover_code,
recover_edit_password,
recover_password,
related_content,
signup,
wrong_verification_code,
ResetPasswordView,
)

urlpatterns = [
Expand All @@ -41,26 +36,21 @@
name="login",
),
path("logout/", auth_views.LogoutView.as_view(), name="logout"),
path('reset-password/', ResetPasswordView.as_view(), name='reset-password'),
path('password-reset-confirm/<uidb64>/<token>/',
auth_views.PasswordResetConfirmView.as_view(template_name='users/reset-password/password_reset_confirm.jinja2'),
name='password_reset_confirm'),
path('password-reset-complete/',
auth_views.PasswordResetCompleteView.as_view(template_name='users/reset-password/password_reset_complete.jinja2'),
name='password_reset_complete'),
# path("recover/", recover_password, name="recover"),
# path("recover-code/", recover_code, name="recover-code"),
# path(
# "wrong-verification-code",
# wrong_verification_code,
# name="wrong-verification-code",
# ),
# path(
# "invalid-recovering-email",
# invalid_recovering_email_or_username,
# name="invalid_recovering_email_or_username",
# ),
# path("recover-edit-password", recover_edit_password, name="recover-edit-password"),
path("reset-password/", ResetPasswordView.as_view(), name="reset-password"),
path(
"password-reset-confirm/<uidb64>/<token>/",
auth_views.PasswordResetConfirmView.as_view(
template_name="users/reset-password/password_reset_confirm.jinja2"
),
name="password_reset_confirm",
),
path(
"password-reset-complete/",
auth_views.PasswordResetCompleteView.as_view(
template_name="users/reset-password/password_reset_complete.jinja2"
),
name="password_reset_complete",
),
path("profile/", profile, name="profile"),
path("profile/edit/", edit_profile, name="edit-profile"),
path("profile/edit-password/", edit_password, name="edit-password"),
Expand Down
30 changes: 15 additions & 15 deletions src/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
login,
update_session_auth_hash,
)

from django.utils.translation import gettext_lazy as _
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import SetPasswordForm
from django.contrib.auth.views import PasswordResetView
from django.contrib.messages.views import SuccessMessageMixin
from django.http import Http404, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import cache_page
from django.views.decorators.http import require_http_methods

Expand All @@ -29,10 +30,7 @@
UploadObjectForm,
)
from .models import Profile
from .services import (BOT_SCORE, create_assessment)
from django.urls import reverse_lazy
from django.contrib.auth.views import PasswordResetView
from django.contrib.messages.views import SuccessMessageMixin
from .services import BOT_SCORE, create_assessment

log = logging.getLogger(__file__)

Expand Down Expand Up @@ -75,14 +73,16 @@ def signup(request):


class ResetPasswordView(SuccessMessageMixin, PasswordResetView):
template_name = 'users/reset-password/password_reset.jinja2'
email_template_name = 'users/reset-password/password_reset_email.html'
subject_template_name = 'users/reset-password/password_reset_subject.txt'
success_message = _("We've emailed you instructions for setting your password, " \
"if an account exists with the email you entered. You should receive them shortly." \
" If you don't receive an email, " \
"please make sure you've entered the address you registered with, and check your spam folder.")
success_url = reverse_lazy('home')
template_name = "users/reset-password/password_reset.jinja2"
email_template_name = "users/reset-password/password_reset_email.html"
subject_template_name = "users/reset-password/password_reset_subject.txt"
success_message = _(
"We've emailed you instructions for setting your password, "
"if an account exists with the email you entered. You should receive them shortly."
" If you don't receive an email, "
"please make sure you've entered the address you registered with, and check your spam folder."
)
success_url = reverse_lazy("home")


@login_required
Expand Down

0 comments on commit 48c7c89

Please sign in to comment.