diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index d54347f0f..f55051812 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -56,7 +56,7 @@ urlpatterns = [ views.ConfirmEmailCode.as_view(), name="confirm-email-code", ), - re_path(r"resend-link", views.resend_link, name="resend-link"), + re_path(r"^resend-link/?$", views.resend_link, name="resend-link"), re_path(r"^logout/?$", views.Logout.as_view(), name="logout"), re_path( r"^password-reset/?$", diff --git a/bookwyrm/views/admin/invite.py b/bookwyrm/views/admin/invite.py index 44644e195..f4c82e485 100644 --- a/bookwyrm/views/admin/invite.py +++ b/bookwyrm/views/admin/invite.py @@ -51,7 +51,7 @@ class ManageInvites(View): """creates an invite database entry""" form = forms.CreateInviteForm(request.POST) if not form.is_valid(): - return HttpResponseBadRequest("ERRORS : %s" % (form.errors,)) + return HttpResponseBadRequest(f"ERRORS: {form.errors}") invite = form.save(commit=False) invite.user = request.user @@ -98,6 +98,7 @@ class ManageInviteRequests(View): "invite__times_used", "invite__invitees__created_date", ] + # pylint: disable=consider-using-f-string if not sort in sort_fields + ["-{:s}".format(f) for f in sort_fields]: sort = "-created_date" @@ -149,6 +150,7 @@ class ManageInviteRequests(View): ) invite_request.save() emailing.invite_email(invite_request) + # pylint: disable=consider-using-f-string return redirect( "{:s}?{:s}".format( reverse("settings-invite-requests"), urlencode(request.GET.dict()) diff --git a/bookwyrm/views/block.py b/bookwyrm/views/block.py index 99014a937..0b80c327d 100644 --- a/bookwyrm/views/block.py +++ b/bookwyrm/views/block.py @@ -24,7 +24,7 @@ class Block(View): models.UserBlocks.objects.create( user_subject=request.user, user_object=to_block ) - return redirect("/preferences/block") + return redirect("prefs-block") @require_POST @@ -40,4 +40,4 @@ def unblock(request, user_id): except models.UserBlocks.DoesNotExist: return HttpResponseNotFound() block.delete() - return redirect("/preferences/block") + return redirect("prefs-block") diff --git a/bookwyrm/views/edit_user.py b/bookwyrm/views/edit_user.py index 4026a5319..0a2d93275 100644 --- a/bookwyrm/views/edit_user.py +++ b/bookwyrm/views/edit_user.py @@ -34,9 +34,9 @@ class EditUser(View): data = {"form": form, "user": request.user} return TemplateResponse(request, "preferences/edit_user.html", data) - user = save_user_form(form) + save_user_form(form) - return redirect(user.local_path) + return redirect("user-feed", request.user.localname) # pylint: disable=no-self-use diff --git a/bookwyrm/views/notifications.py b/bookwyrm/views/notifications.py index b96bc9259..d6897f390 100644 --- a/bookwyrm/views/notifications.py +++ b/bookwyrm/views/notifications.py @@ -29,4 +29,4 @@ class Notifications(View): def post(self, request): """permanently delete notification for user""" request.user.notification_set.filter(read=True).delete() - return redirect("/notifications") + return redirect("notifications") diff --git a/bookwyrm/views/password.py b/bookwyrm/views/password.py index baf1b3ff4..ce055721c 100644 --- a/bookwyrm/views/password.py +++ b/bookwyrm/views/password.py @@ -97,9 +97,9 @@ class ChangePassword(View): confirm_password = request.POST.get("confirm-password") if new_password != confirm_password: - return redirect("preferences/password") + return redirect("prefs-password") request.user.set_password(new_password) request.user.save(broadcast=False, update_fields=["password"]) login(request, request.user) - return redirect(request.user.local_path) + return redirect("user-feed", request.user.localname)