reg/views.py
changeset 19 115860e87238
parent 18 7dae32a2439b
child 20 9354ef8119c6
equal deleted inserted replaced
18:7dae32a2439b 19:115860e87238
   338                'previous_events': Event.objects.filter(stop_date__lt=today),
   338                'previous_events': Event.objects.filter(stop_date__lt=today),
   339               }
   339               }
   340 
   340 
   341     return render_to_response('list_events.html', context)
   341     return render_to_response('list_events.html', context)
   342 
   342 
       
   343 def list_attendees(request, event_key):
       
   344     """ see if the request user is org.
       
   345     Else redirect him to homepage.
       
   346     """
       
   347 
       
   348     user = request.user
       
   349     try:
       
   350         event = Event.objects.get(key__iexact=event_key)
       
   351     except Event.DoesNotExist:
       
   352         return redirect('/reg')
       
   353 
       
   354     if not user in event.organizers.all():
       
   355         return redirect('/reg')
       
   356     
       
   357     profile = user.get_profile()
       
   358     return render_to_response('list_attendees.html', {'user':user, 'event':event, 'attendees':event.attendees.all()})