Revert school tab in user profile

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent 4e07392354
commit 4cc52836e9
  1. 8
      apps/user/templates/user/profile.html
  2. 17
      apps/user/views.py

@ -71,6 +71,7 @@
<span class="mobile-hide">КУРСЫ</span>
</button>
{% endif %}
<button class="tabs__btn js-tabs-btn">ШКОЛА</button>
</div>
<div class="tabs__container">
<div class="tabs__item js-tabs-item">
@ -89,6 +90,13 @@
</div>
</div>
{% endif %}
<div class="tabs__item js-tabs-item">
<div class="courses courses_scroll">
<div class="courses__list">
{% include "course/school.html" %}
</div>
</div>
</div>
</div>
</div>
</div>

@ -63,6 +63,23 @@ class UserView(DetailView):
],
),
).distinct()
school_payment = SchoolPayment.objects.filter(
user=self.object,
date_start__lte=now(),
date_end__gt=now(),
status__in=[
Pingback.PINGBACK_TYPE_REGULAR,
Pingback.PINGBACK_TYPE_GOODWILL,
Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED,
],
).last()
context['school_payment'] = school_payment
if school_payment and school_payment.date_end:
context['school_days_left'] = (school_payment.date_end - now().date()).days
context['school_schedules'] = SchoolSchedule.objects.filter(
weekday__in=school_payment.weekdays if school_payment else [],
)
return context

Loading…
Cancel
Save