From: Gael Le Mignot Date: Fri, 5 Jun 2020 12:25:05 +0000 (+0200) Subject: Minor bug fixes in inscription module X-Git-Tag: 1.4.3~75^2~2^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d18f1f4b5ab9e436f118d14f25638a54a700bf6d;p=teleforma.git Minor bug fixes in inscription module --- diff --git a/teleforma/webclass/templates/webclass/appointments.html b/teleforma/webclass/templates/webclass/appointments.html index de9b8b90..c30374fd 100644 --- a/teleforma/webclass/templates/webclass/appointments.html +++ b/teleforma/webclass/templates/webclass/appointments.html @@ -54,7 +54,7 @@ {% for slot in slots %}
- {{slot.day}} de {{slot.start_hour|date:"H\hi"}}}} à {{slot.end_hour|date:"H\hi"}}}} + {{slot.day}} de {{slot.start_hour|date:"H\hi"}} à {{slot.end_hour|date:"H\hi"}} {% csrf_token %} diff --git a/teleforma/webclass/views.py b/teleforma/webclass/views.py index 9b100053..ac33d57d 100644 --- a/teleforma/webclass/views.py +++ b/teleforma/webclass/views.py @@ -37,9 +37,10 @@ class WebclassAppointment(View): def check_rights(self, user, webclass): if not user.is_authenticated(): return HttpResponseRedirect(reverse('teleforma-login')) - student = user.student.all().count() + student = user.student.all()[:1] if not student: return HttpResponse('Unauthorized', status=401) + student = student[0] # check period period_id = webclass.period.id periods = [ p for p in get_periods(user) if int(p.id) == period_id ] @@ -83,7 +84,8 @@ class WebclassAppointment(View): if not slot.participant_slot_available: return u"Ce créneau n'est plus disponible." - # # Check we don't have another appointment on this period + # Check we don't have another appointment on this period + webclass = slot.webclass if webclass.get_slot(user): return u"Vous êtes déjà inscrit." @@ -166,4 +168,4 @@ def join_webclass(request, pk): if authorized: return redirect(webclass_slot.get_join_webclass_url(request, user)) else: - return HttpResponse('Unauthorized', status=401) \ No newline at end of file + return HttpResponse('Unauthorized', status=401)