From 83919037b9f4d4a318d2d7f089edfb5f1928d8f2 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 1 Aug 2018 19:39:11 +0500 Subject: [PATCH] =?UTF-8?q?LIL-606=20=D0=9E=D0=B1=D1=8B=D1=87=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=20=D0=B2=D0=B8=D0=B4=D0=B8=D1=82=20=D0=B2?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D0=B4=D0=BA=D1=83=20=D0=9E=D0=BF=D1=83=D0=B1?= =?UTF-8?q?=D0=BB=D0=B8=D0=BA=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=BA=D1=83=D1=80=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/user/templates/user/notification-settings.html | 2 +- apps/user/templates/user/payment-history.html | 2 +- apps/user/templates/user/profile-settings.html | 2 +- apps/user/views.py | 11 +++++++---- project/templates/blocks/user_menu.html | 2 +- project/urls.py | 4 ++-- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/user/templates/user/notification-settings.html b/apps/user/templates/user/notification-settings.html index f2688060..40c679e5 100644 --- a/apps/user/templates/user/notification-settings.html +++ b/apps/user/templates/user/notification-settings.html @@ -2,7 +2,7 @@
diff --git a/apps/user/templates/user/payment-history.html b/apps/user/templates/user/payment-history.html index 5643dfa5..c27a3faa 100644 --- a/apps/user/templates/user/payment-history.html +++ b/apps/user/templates/user/payment-history.html @@ -2,7 +2,7 @@
diff --git a/apps/user/templates/user/profile-settings.html b/apps/user/templates/user/profile-settings.html index f590c7f9..5502c21d 100644 --- a/apps/user/templates/user/profile-settings.html +++ b/apps/user/templates/user/profile-settings.html @@ -2,7 +2,7 @@
diff --git a/apps/user/views.py b/apps/user/views.py index abbd2e4d..da1245ae 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -41,7 +41,7 @@ def resend_email_verify(request): url = request.scheme + '://' + request.get_host() + str(reverse_lazy('lilcity:verification-email', args=[token, request.user.id])) send_email('Вы успешно прошли регистрацию', request.user.email, "notification/email/verification_email.html", url=url) messages.info(request, 'Письмо подтверждения отправлено.') - return redirect('user-edit-profile', request.user.id) + return redirect('user-edit-profile') @method_decorator(login_required, name='dispatch') @@ -200,13 +200,16 @@ class PaymentHistoryView(FormView): @method_decorator(login_required, name='dispatch') -class UserEditView(UpdateView): +class ProfileEditView(UpdateView): model = User template_name = 'user/profile-settings.html' form_class = UserEditForm + def get_object(self, queryset=None): + return self.request.user + def dispatch(self, request, *args, **kwargs): - self.object = request.user + self.object = self.get_object() return super().dispatch(request, *args, **kwargs) def post(self, request, *args, **kwargs): @@ -252,7 +255,7 @@ class UserEditView(UpdateView): return super().post(request, *args, **kwargs) def get_success_url(self): - return reverse('user-edit-profile', args=[self.object.id]) + return reverse('user-edit-profile') class AuthorRequestView(FormView): diff --git a/project/templates/blocks/user_menu.html b/project/templates/blocks/user_menu.html index e1bc7d57..95e2b7d3 100644 --- a/project/templates/blocks/user_menu.html +++ b/project/templates/blocks/user_menu.html @@ -1,7 +1,7 @@ {% load static %} {% load thumbnail %} {% if request.user.is_authenticated %}