now show report page does not show report if there are no feedbacks .
--- a/feedback/utils.py Thu Apr 15 14:38:48 2010 +0530
+++ b/feedback/utils.py Thu Apr 15 14:50:47 2010 +0530
@@ -70,7 +70,7 @@
no_of_feeds = feeds.count()
if not no_of_feeds:
- return {}
+ return []
day_report = []
--- a/feedback/views.py Thu Apr 15 14:38:48 2010 +0530
+++ b/feedback/views.py Thu Apr 15 14:50:47 2010 +0530
@@ -99,6 +99,8 @@
for day in days:
day_num = str(day)
day_feeds = Feedback.objects.filter(event=event,day=day_num)
- workshop_report.extend( [ "Day %s"%day_num, make_day_report(day_feeds) ] )
+ day_report = make_day_report(day_feeds)
+ if day_report:
+ workshop_report.extend( [ "Day %s"%day_num, day_report] )
return render_to_response("show_report.html", {"user":user, "event":event, "workshop_report":workshop_report})
--- a/reg/views.py Thu Apr 15 14:38:48 2010 +0530
+++ b/reg/views.py Thu Apr 15 14:50:47 2010 +0530
@@ -248,15 +248,19 @@
except Event.DoesNotExist:
raise Http404
- if user in event.organizers.all() and user.is_staff and event.feedback_status == '0':
- no_of_days = (event.stop_date - event.start_date).days + 1
- if request.method == "POST":
- day = request.POST['day']
- event.feedback_status = day
- event.save()
+ if user in event.organizers.all() and user.is_staff:
+ if event.feedback_status == '0':
+ no_of_days = (event.stop_date - event.start_date).days + 1
+ if request.method == "POST":
+ day = request.POST['day']
+ event.feedback_status = day
+ event.save()
+ return render_to_response('open_feedback.html', {'user':user, 'success': True, 'day':day, 'event':event})
+ else:
+ return render_to_response('open_feedback.html', {'user':user, 'event': event, 'days': range(1,no_of_days+1)})
+ else:
+ day = event.feedback_status
return render_to_response('open_feedback.html', {'user':user, 'success': True, 'day':day, 'event':event})
- else:
- return render_to_response('open_feedback.html', {'user':user, 'event': event, 'days': range(1,no_of_days+1)})
else:
raise Http404
--- a/templates/open_feedback.html Thu Apr 15 14:38:48 2010 +0530
+++ b/templates/open_feedback.html Thu Apr 15 14:50:47 2010 +0530
@@ -2,7 +2,6 @@
{% block content %}
{% if success %}
The feedback for day {{day}} of <a href="/reg/event/view/{{event.key}}">{{event.title}}</a> has been opened.<br />
- <a href="/reg/event/view/{{event.key}}">Return to view the event page</a>
{% else %}
Select the day of workshop <a href="/reg/event/view/{{event.key}}">{{event.title}}</a> to start accepting feedbacks.
<form action="" method="post">
--- a/templates/show_report.html Thu Apr 15 14:38:48 2010 +0530
+++ b/templates/show_report.html Thu Apr 15 14:50:47 2010 +0530
@@ -1,6 +1,7 @@
{% extends "base.html" %}
{% block content %}
-Report of the workshop <a href="/reg/event/view/{{event.key}}">{{event.title}}</a>
+Report of the workshop <a href="/reg/event/view/{{event.key}}">{{event.title}}</a> conducted at {{event.venue}}
+from {{event.start_date|date:"d M Y"}} to {{event.stop_date|date:"d M Y"}}
<br />
{{workshop_report|unordered_list}}
{% endblock %}
--- a/templates/view_event.html Thu Apr 15 14:38:48 2010 +0530
+++ b/templates/view_event.html Thu Apr 15 14:50:47 2010 +0530
@@ -30,9 +30,9 @@
<a href="/feedback/report/{{event.key}}">View a report of the workshop</a><br /><br />
{% if user.is_staff %}
{% if event.registration_is_open %}
- <a href="/reg/event/registration/close/{{event.key}}">Close the registration</a><br />
+ <a href="/reg/event/registration/close/{{event.key}}">Close registration</a><br />
{% else %}
- <a href="/reg/event/registration/open/{{event.key}}">Open the registration</a><br />
+ <a href="/reg/event/registration/open/{{event.key}}">Open registration</a><br />
{% endif %}
<!--
{% ifequal event.quiz_status "00" %}
@@ -44,7 +44,7 @@
{% ifequal event.feedback_status "0" %}
<a href="/reg/event/feedback/open/{{event.key}}">Open feedback</a><br />
{% else %}
- <a href="/reg/event/feedback/close/{{event.key}}">Close the feedback for day {{event.feedback_status}}</a><br />
+ <a href="/reg/event/feedback/close/{{event.key}}">Close feedback for day {{event.feedback_status}}</a><br />
{% endifequal %}
{% endif %}
{% endif %}