def points(request, meeting_pk=None): if request.method == 'POST': try: a = Attendance.objects.get(pk=request.POST['attendance_pk']) except Attendance.DoesNotExist: return HttpResponseNotFound() a.points = request.POST['points'] a.save() return HttpResponse() try: meeting = ( Meeting.objects.get(pk=meeting_pk) if meeting_pk is not None else Meeting.most_recent() ) except Meeting.DoesNotExist: return HttpResponseNotFound() attendances = ( Attendance.objects .filter(meeting=meeting) .order_by('member__user__first_name', 'member__user__last_name') ) d = { 'meeting': meeting, 'attendances': attendances, } return render(request, 'dashboard/points.html', d)
def raffle(request, meeting_pk=None): if meeting_pk is None: try: default_meeting = Meeting.most_recent() except Meeting.DoesNotExist: default_meeting = None return render(request, 'dashboard/make_raffle.html', { 'meetings': Meeting.objects.all(), 'default_meeting': default_meeting, }) else: attendances = Attendance.objects.filter(meeting__pk=meeting_pk) return render(request, 'dashboard/raffle.html', { 'attendances': attendances, })