# HG changeset patch
# User nishanth
# Date 1271320186 -19800
# Node ID ab0a8a72b06930677ccaebc229bdb6036fa6918c
# Parent c1fff32eb4948ee7da88a22221f8265ffe21631a
added view report functionality. have to make it look better.
diff -r c1fff32eb494 -r ab0a8a72b069 feedback/site/urls.py
--- a/feedback/site/urls.py Thu Apr 15 12:38:29 2010 +0530
+++ b/feedback/site/urls.py Thu Apr 15 13:59:46 2010 +0530
@@ -5,4 +5,5 @@
urlpatterns = patterns('',
('^submit/(\w+)$', feed_views.submit_feedback),
('^list/(\w+)$', feed_views.list_feedbacks),
+ ('^report/(\w+)$', feed_views.view_report),
)
diff -r c1fff32eb494 -r ab0a8a72b069 feedback/views.py
--- a/feedback/views.py Thu Apr 15 12:38:29 2010 +0530
+++ b/feedback/views.py Thu Apr 15 13:59:46 2010 +0530
@@ -4,7 +4,7 @@
from workshop.feedback.models import Feedback
from workshop.feedback.forms import FeedbackForm
-from workshop.feedback.utils import compile_report
+from workshop.feedback.utils import make_day_report
from django.http import HttpResponse
@@ -73,7 +73,32 @@
for feed in day_feeds:
day_list.append(" ".join((feed.topics, feed.depth, feed.methodology, feed.pace,
feed.applicability, feed.problems, feed.exercises, feed.comments)))
- feeds_list.append(["Day %s"%day, day_list])
+ feeds_list.extend(["Day %s"%day, day_list])
return render_to_response('list_feedbacks.html',{'user':user, 'event':event, 'feeds_list':feeds_list})
+def view_report(request, event_key):
+ """ compile the report and display it.
+ """
+
+ user = request.user
+
+ try:
+ event = Event.objects.get(key__iexact=event_key)
+ except Event.DoesNotExist:
+ raise Http404
+
+ if not user in event.organizers.all():
+ raise Http404
+
+ no_of_days = (event.stop_date - event.start_date).days
+ days = range(1,no_of_days+2)
+
+ workshop_report = []
+
+ 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) ] )
+
+ return render_to_response("show_report.html", {"user":user, "event":event, "workshop_report":workshop_report})
diff -r c1fff32eb494 -r ab0a8a72b069 templates/list_feedbacks.html
--- a/templates/list_feedbacks.html Thu Apr 15 12:38:29 2010 +0530
+++ b/templates/list_feedbacks.html Thu Apr 15 13:59:46 2010 +0530
@@ -2,7 +2,5 @@
{% block content %}
List of feedbacks submitted for the workshop {{event.title}}
-{% for day_list in feeds_list %}
- {{day_list|unordered_list}}
-{% endfor %}
+{{feeds_list|unordered_list}}
{% endblock %}
diff -r c1fff32eb494 -r ab0a8a72b069 templates/view_event.html
--- a/templates/view_event.html Thu Apr 15 12:38:29 2010 +0530
+++ b/templates/view_event.html Thu Apr 15 13:59:46 2010 +0530
@@ -25,8 +25,8 @@
{% if is_org %}
View list of people registered for the workshop
- View submitted feedbacks
- View a report of the workshop
+ View submitted feedbacks
+ View a report of the workshop
{% if user.is_staff %}
{% if event.registration_is_open %}
Close the registration