def attendance_time_window(request, club = None): if club: club_obj = Club.objects.get(Slug = club) else: club_obj = None personqset = Person.objects.none() if request.method == 'POST': form = WindowAttendanceForm(request.POST) if form.is_valid(): personqset = Person.objects.time_window_qset(form.cleaned_data['Start_date'], form.cleaned_data['End_date'], club_obj) return render_to_response('Dojo/Person_object_list.html', { 'club':club_obj, 'person_list':personqset, 'window_form':form }) else: form = WindowAttendanceForm() return render_to_response('Dojo/Person_object_list.html', { 'club':club_obj, 'person_list':personqset, 'window_form':form })
def person_list(request, club = None): if club: try: club_obj = Club.objects.get(Slug = club) except Club.DoesNotExist: club_obj = None else: club_obj = None request.session['last_page'] = request.path personqset = Person.objects.none() if request.method == 'POST': form = WindowAttendanceForm(request.POST) if form.is_valid(): club_obj = form.cleaned_data['Club'] personqset = Person.objects.time_window_qset(form.cleaned_data['Start_date'], form.cleaned_data['End_date'], club_obj) return render_to_response('Dojo/Person_object_list.html', { 'club':club_obj, 'person_list':personqset, 'window_form':form }) else: form = WindowAttendanceForm() info_dict = { 'club':club_obj, 'window_form':form, 'person_list':personqset } return render_to_response('Dojo/Person_object_list.html', info_dict, context_instance = RequestContext(request))