246 try: |
246 try: |
247 event = Event.objects.get(key__iexact=event_key) |
247 event = Event.objects.get(key__iexact=event_key) |
248 except Event.DoesNotExist: |
248 except Event.DoesNotExist: |
249 raise Http404 |
249 raise Http404 |
250 |
250 |
251 if user in event.organizers.all() and user.is_staff and event.feedback_status == '0': |
251 if user in event.organizers.all() and user.is_staff: |
252 no_of_days = (event.stop_date - event.start_date).days + 1 |
252 if event.feedback_status == '0': |
253 if request.method == "POST": |
253 no_of_days = (event.stop_date - event.start_date).days + 1 |
254 day = request.POST['day'] |
254 if request.method == "POST": |
255 event.feedback_status = day |
255 day = request.POST['day'] |
256 event.save() |
256 event.feedback_status = day |
|
257 event.save() |
|
258 return render_to_response('open_feedback.html', {'user':user, 'success': True, 'day':day, 'event':event}) |
|
259 else: |
|
260 return render_to_response('open_feedback.html', {'user':user, 'event': event, 'days': range(1,no_of_days+1)}) |
|
261 else: |
|
262 day = event.feedback_status |
257 return render_to_response('open_feedback.html', {'user':user, 'success': True, 'day':day, 'event':event}) |
263 return render_to_response('open_feedback.html', {'user':user, 'success': True, 'day':day, 'event':event}) |
258 else: |
|
259 return render_to_response('open_feedback.html', {'user':user, 'event': event, 'days': range(1,no_of_days+1)}) |
|
260 else: |
264 else: |
261 raise Http404 |
265 raise Http404 |
262 |
266 |
263 def close_feedback(request, event_key): |
267 def close_feedback(request, event_key): |
264 """ check if the user is org. |
268 """ check if the user is org. |