# HG changeset patch # User nishanth # Date 1277984157 -19800 # Node ID 404e9c1b8cff9599b2a34a03c563ba79b84acc66 # Parent 451be7b1de20e0d769f5fbd493d696616e2e0a0f now questions are displayed properly in edit_question page. hav to implement the submit and stuff diff -r 451be7b1de20 -r 404e9c1b8cff event/forms.py --- a/event/forms.py Thu Jul 01 16:55:22 2010 +0530 +++ b/event/forms.py Thu Jul 01 17:05:57 2010 +0530 @@ -1,7 +1,7 @@ from django import forms from offline.event.models import Event, QUIZ_CHOICES -from offline.quiz.models import TOPIC_CHOICES +from offline.quiz.models import QuestionBank, TOPIC_CHOICES class EventCreateForm(forms.ModelForm): diff -r 451be7b1de20 -r 404e9c1b8cff event/views.py --- a/event/views.py Thu Jul 01 16:55:22 2010 +0530 +++ b/event/views.py Thu Jul 01 17:05:57 2010 +0530 @@ -5,7 +5,7 @@ from offline.settings import ADMIN_KEY from offline.event.models import Event -from offline.event.forms import EventCreateForm, OpenQuizForm +from offline.event.forms import EventCreateForm, OpenQuizForm, EditQuestionForm from offline.quiz.models import Quiz, QuestionBank, TOPIC_CHOICES from offline.quiz.utils import correct_quiz @@ -218,7 +218,7 @@ except QuestionBank.DoesNotExist: raise Http404 - if request.medhod == "POST": + if request.method == "POST": pass else: form = EditQuestionForm(q.get_values()) diff -r 451be7b1de20 -r 404e9c1b8cff quiz/models.py --- a/quiz/models.py Thu Jul 01 16:55:22 2010 +0530 +++ b/quiz/models.py Thu Jul 01 17:05:57 2010 +0530 @@ -43,6 +43,18 @@ time_limit = models.PositiveSmallIntegerField() expected_ans = models.TextField() + def get_values(self): + + values_dict = {"quiz_num" : self.quiz_num, + "topic" : self.topic, + "description" : self.description, + "code" : self.code, + "options" : self.options, + "time_limit" : self.time_limit, + "expected_ans" : self.expected_ans, + } + return values_dict + def __unicode__(self): return self.description diff -r 451be7b1de20 -r 404e9c1b8cff templates/edit_question.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/edit_question.html Thu Jul 01 17:05:57 2010 +0530 @@ -0,0 +1,4 @@ +{% extends "base.html" %} +{% block content %} +{{form.as_p}} +{% endblock %}