payment for next month, guest view for profile, teacher page link

remotes/origin/hasaccess
Sanasol 8 years ago
parent b5940831ff
commit a0e3136603
  1. 4
      apps/payment/views.py
  2. 5
      apps/user/templates/user/profile.html
  3. 10
      apps/user/views.py
  4. 9
      project/templates/blocks/teachers.html

@ -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

@ -2,7 +2,9 @@
<div class="section">
<div class="section__center center">
<div class="profile">
{% if not guest %}
<a class="profile__btn profile__btn_edit btn" href="{% url 'user-edit-profile' user.id %}">Редактировать</a>
{% endif %}
<div class="profile__ava ava">
{% thumbnail user.photo "120x120" crop="center" as im %}
<img class="ava__pic" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />
@ -59,6 +61,8 @@
</div>
</div>
</div>
{% if not guest %}
<div class="section section_pink-light section_tabs">
<div class="section__center center">
<div class="tabs js-tabs">
@ -138,4 +142,5 @@
</div>
</div>
</div>
{% endif %}
{% endblock content %}

@ -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,
)

@ -16,10 +16,11 @@
<img class="ava__pic" src="{% static 'img/user_default.jpg' %}"> {% endif %}
</div>
<div class="teachers__wrap">
<div class="teachers__title">{{ teacher.get_full_name }}{% if teacher.instagram_hashtag %},
<a href='https://www.instagram.com/explore/tags/{{ teacher.instagram_hashtag }}/' target="_blank">
#{{ teacher.instagram_hashtag }}
</a>
<div class="teachers__title">
<a href="{% url 'user' teacher.id %}">{{ teacher.get_full_name }}</a>{% if teacher.instagram_hashtag %},
<a href='https://www.instagram.com/explore/tags/{{ teacher.instagram_hashtag }}/' target="_blank">
{{ teacher.instagram_hashtag }}
</a>
{% endif %}
</div>
<div class="teachers__social">

Loading…
Cancel
Save