now questions are displayed properly in edit_question page. hav to implement the submit and stuff
authornishanth
Thu, 01 Jul 2010 17:05:57 +0530
changeset 86 404e9c1b8cff
parent 85 451be7b1de20
child 87 e81b105b1128
now questions are displayed properly in edit_question page. hav to implement the submit and stuff
event/forms.py
event/views.py
quiz/models.py
templates/edit_question.html
--- 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):
 
--- 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())
--- 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
--- /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 %}