diff --git a/event/views.py b/event/views.py index 5a5d3df..6e29dde 100644 --- a/event/views.py +++ b/event/views.py @@ -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}))