reg/views.py
changeset 29 5fb4edd157e1
parent 28 14c5ccb18159
child 30 b85cb9cc9010
equal deleted inserted replaced
28:14c5ccb18159 29:5fb4edd157e1
   271     try:
   271     try:
   272         event = Event.objects.get(key__iexact=event_key)
   272         event = Event.objects.get(key__iexact=event_key)
   273     except Event.DoesNotExist:
   273     except Event.DoesNotExist:
   274         return redirect("/reg")
   274         return redirect("/reg")
   275 
   275 
   276     is_org = True if user in event.organizers.all() else False
   276     is_org = True if user in event.organizers.all() and user.is_staff else False
   277 
   277 
   278     if is_org:
   278     if is_org:
   279         day = event.feedback_status
   279         day = event.feedback_status
   280         event.feedback_status = '0'
   280         event.feedback_status = '0'
   281         event.save()
   281         event.save()
   291     try:
   291     try:
   292         event = Event.objects.get(key__iexact=event_key)
   292         event = Event.objects.get(key__iexact=event_key)
   293     except Event.DoesNotExist:
   293     except Event.DoesNotExist:
   294         return redirect("/reg")
   294         return redirect("/reg")
   295 
   295 
   296     is_org = True if user in event.organizers.all() else False
   296     is_org = True if user in event.organizers.all() and user.is_staff else False
   297 
   297 
   298     if is_org:
   298     if is_org:
   299         event.registration_is_open = True
   299         event.registration_is_open = True
   300         event.save()
   300         event.save()
   301         return render_to_response('reg_open.html', {'user':user, 'event': event})
   301         return render_to_response('reg_open.html', {'user':user, 'event': event})
   310     try:
   310     try:
   311         event = Event.objects.get(key__iexact=event_key)
   311         event = Event.objects.get(key__iexact=event_key)
   312     except Event.DoesNotExist:
   312     except Event.DoesNotExist:
   313         return redirect("/reg")
   313         return redirect("/reg")
   314 
   314 
   315     is_org = True if user in event.organizers.all() else False
   315     is_org = True if user in event.organizers.all() and user.is_staff else False
   316 
   316 
   317     if is_org:
   317     if is_org:
   318         event.registration_is_open = False
   318         event.registration_is_open = False
   319         event.save()
   319         event.save()
   320         return render_to_response('reg_close.html', {'user':user, 'event': event})
   320         return render_to_response('reg_close.html', {'user':user, 'event': event})