From a0e3136603dee07a6edc63c91ed4d53bae6999fb Mon Sep 17 00:00:00 2001 From: Sanasol Date: Wed, 13 Jun 2018 15:15:48 +0300 Subject: [PATCH] payment for next month, guest view for profile, teacher page link --- apps/payment/views.py | 4 ++-- apps/user/templates/user/profile.html | 5 +++++ apps/user/views.py | 10 ++++++++-- project/templates/blocks/teachers.html | 9 +++++---- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/apps/payment/views.py b/apps/payment/views.py index 66a52935..3c80a136 100644 --- a/apps/payment/views.py +++ b/apps/payment/views.py @@ -201,13 +201,13 @@ class PaymentwallCallbackView(View): ).last() if school_payment: if payment.add_days: - date_start = now() + date_start = now().shift(months=1).replace(hour=0, minute=0, day=1) date_end = school_payment.date_end else: date_start = arrow.get(school_payment.date_end).shift(days=1).datetime date_end = arrow.get(date_start).shift(months=1).datetime else: - date_start = now() + date_start = now().shift(months=1).replace(hour=0, minute=0, day=1) date_end = arrow.get(date_start).shift(months=1).datetime payment.date_start = date_start payment.date_end = date_end diff --git a/apps/user/templates/user/profile.html b/apps/user/templates/user/profile.html index c2acc385..7a10411d 100644 --- a/apps/user/templates/user/profile.html +++ b/apps/user/templates/user/profile.html @@ -2,7 +2,9 @@
+ {% if not guest %} Редактировать + {% endif %}
{% thumbnail user.photo "120x120" crop="center" as im %} @@ -59,6 +61,8 @@
+ +{% if not guest %}
@@ -138,4 +142,5 @@
+{% endif %} {% endblock content %} diff --git a/apps/user/views.py b/apps/user/views.py index 81f5f34f..b24825ab 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -43,14 +43,20 @@ def resend_email_verify(request): return redirect('user-edit-profile', request.user.id) -@method_decorator(login_required, name='dispatch') +# @method_decorator(login_required, name='dispatch') class UserView(DetailView): model = User template_name = 'user/profile.html' def get_context_data(self, object): context = super().get_context_data() - context['simple_user'] = self.request.user.role == User.USER_ROLE + if not self.request.user.is_anonymous: + context['simple_user'] = self.request.user.role == User.USER_ROLE + context['guest'] = self.request.user.id != self.object.id and self.request.user.role <= User.USER_ROLE + else: + context['simple_user'] = True + context['guest'] = True + context['published'] = Course.objects.filter( author=self.object, ) diff --git a/project/templates/blocks/teachers.html b/project/templates/blocks/teachers.html index 79623393..639d6b90 100644 --- a/project/templates/blocks/teachers.html +++ b/project/templates/blocks/teachers.html @@ -16,10 +16,11 @@ {% endif %}
-
{{ teacher.get_full_name }}{% if teacher.instagram_hashtag %}, - - #{{ teacher.instagram_hashtag }} - +
+ {{ teacher.get_full_name }}{% if teacher.instagram_hashtag %}, + + {{ teacher.instagram_hashtag }} + {% endif %}