# HG changeset patch # User nishanth # Date 1277981417 -19800 # Node ID 848c009b8a600d3c4467beb124747e017da8ab6b # Parent 96da6bf2b6324d322f39ee8449fd657f88646444 now topic name is displayed instead of topic number in list_questions page diff -r 96da6bf2b632 -r 848c009b8a60 event/views.py --- a/event/views.py Thu Jul 01 16:13:01 2010 +0530 +++ b/event/views.py Thu Jul 01 16:20:17 2010 +0530 @@ -7,7 +7,7 @@ from offline.event.models import Event from offline.event.forms import EventCreateForm, OpenQuizForm -from offline.quiz.models import Quiz, QuestionBank +from offline.quiz.models import Quiz, QuestionBank, TOPIC_CHOICES from offline.quiz.utils import correct_quiz num2name = {"11" : "Day 1 Quiz 1", @@ -203,5 +203,9 @@ """ questions = QuestionBank.objects.all() + topic_num2name = dict(TOPIC_CHOICES) + + for question in questions: + question.topic_name = topic_num2name[question.topic] return render_to_response("list_questions.html", {"questions":questions}) diff -r 96da6bf2b632 -r 848c009b8a60 templates/list_questions.html --- a/templates/list_questions.html Thu Jul 01 16:13:01 2010 +0530 +++ b/templates/list_questions.html Thu Jul 01 16:20:17 2010 +0530 @@ -9,7 +9,7 @@ {% for question in questions %} {{question.description}} -{{question.topic}} +{{question.topic_name}} {% endfor %}