mirror of
https://github.com/more-tech4-magnum-opus/backend.git
synced 2024-11-10 22:46:34 +03:00
14 lines
364 B
Python
14 lines
364 B
Python
from rest_framework.generics import get_object_or_404
|
|
|
|
from events.models import EventAttendance
|
|
|
|
|
|
def submit_attendance(token: str):
|
|
attendance = get_object_or_404(EventAttendance, token=token)
|
|
if not attendance.attended:
|
|
attendance.attended = True
|
|
attendance.save()
|
|
|
|
attendance.event.attended += 1
|
|
attendance.event.save()
|