forked from pythonprobr/pythonpro-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviews.py
More file actions
31 lines (22 loc) · 1.1 KB
/
views.py
File metadata and controls
31 lines (22 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
from django.urls import reverse
from rolepermissions.checkers import has_permission
from pythonpro.cohorts import facade
from pythonpro.core.roles import access_cohorts
@login_required
def detail(request, slug):
return render(request, 'cohorts/cohort_detail.html', {'cohort': facade.find_cohort(slug=slug)})
@login_required
def webinars(request):
return render(request, 'cohorts/webinars.html', {'webinars': facade.find_recorded_webinars()})
@login_required
def webinar(request, slug):
if not has_permission(request.user, access_cohorts):
return redirect(reverse('checkout:bootcamp_lp'), permanent=False)
return render(request, 'cohorts/webinar_detail.html', {'webinar': facade.find_webinar(slug=slug)})
@login_required
def live_class(request, pk):
if not has_permission(request.user, access_cohorts):
return redirect(reverse('checkout:bootcamp_lp'), permanent=False)
return render(request, 'cohorts/live_class_detail.html', {'live_class': facade.find_live_class(pk=pk)})