mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
fix: Fix broken activity signup
This commit is contained in:
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
<h2>Attendance</h2>
|
||||||
|
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -74,14 +74,13 @@ class ActivityAttendanceView(permissions.UserIsLinkedPersonMixin, SingleObjectMi
|
|||||||
def get_test_person(self) -> people_models.Person:
|
def get_test_person(self) -> people_models.Person:
|
||||||
data = json.loads(self.request.body)
|
data = json.loads(self.request.body)
|
||||||
|
|
||||||
self.person = people_models.Person.objects.get(pk=data['pk'])
|
return people_models.Person.objects.get(pk=data['pk'])
|
||||||
return self.person
|
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
self.object = self.get_object()
|
self.object = self.get_object()
|
||||||
|
|
||||||
if request.is_ajax():
|
if request.is_ajax():
|
||||||
self.object.attendance_list.add(self.person)
|
self.object.attendance_list.add(self.get_test_person())
|
||||||
|
|
||||||
return HttpResponse(status=204)
|
return HttpResponse(status=204)
|
||||||
|
|
||||||
@@ -91,7 +90,7 @@ class ActivityAttendanceView(permissions.UserIsLinkedPersonMixin, SingleObjectMi
|
|||||||
self.object = self.get_object()
|
self.object = self.get_object()
|
||||||
|
|
||||||
if request.is_ajax():
|
if request.is_ajax():
|
||||||
self.object.attendance_list.remove(self.person)
|
self.object.attendance_list.remove(self.get_test_person())
|
||||||
|
|
||||||
return HttpResponse(status=204)
|
return HttpResponse(status=204)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user