mirror of
https://github.com/more-tech4-magnum-opus/backend.git
synced 2024-11-28 22:03:44 +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()
|