]> git.parisson.com Git - teleforma.git/commitdiff
Minor bug fixes in inscription module
authorGael Le Mignot <gael@pilotsystems.net>
Fri, 5 Jun 2020 12:25:05 +0000 (14:25 +0200)
committerGael Le Mignot <gael@pilotsystems.net>
Fri, 5 Jun 2020 12:25:05 +0000 (14:25 +0200)
teleforma/webclass/templates/webclass/appointments.html
teleforma/webclass/views.py

index de9b8b90fa7694398c9f9d765e4469a4f1a54951..c30374fd6313874107b50e93e47caaa83a175841 100644 (file)
@@ -54,7 +54,7 @@
     
     {% for slot in slots %}
         <form class="booking_form" method="POST">
-            <span class="booking_date">{{slot.day}} de {{slot.start_hour|date:"H\hi"}}}} à {{slot.end_hour|date:"H\hi"}}}}</span>
+            <span class="booking_date">{{slot.day}} de {{slot.start_hour|date:"H\hi"}} à {{slot.end_hour|date:"H\hi"}}</span>
             {% csrf_token %}
             <input type="hidden" name="slot_id" value="{{slot.id}}" />
             <input type="submit" value="Sélectionner" />
index 9b10005348da55b92b6b0ed7aed713d27b3fbf2f..ac33d57d7b3c019094a15091691297184816eb7d 100644 (file)
@@ -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)