enrol?ajax=json renvoie un JSON pour le calendrier dynamique

This commit is contained in:
Evarin 2018-11-12 21:44:10 +01:00
parent b1c0dd857d
commit 511c3096f7

View file

@ -52,6 +52,12 @@ class EnrolActivityView(LoginRequiredMixin, View):
else:
success = False
if "ajax" in request.GET:
if request.GET["ajax"] == "json":
enrols = activity.staff
return JsonResponse({
"enrolled": enrols.filter(id=request.user.id).exists(),
"number": enrols.count(),
})
return render(request, "event/activity_summary.html",
{"activity": activity})
return HttpResponseRedirect(reverse("event:activity", kwargs={"pk":pk}))