now editing question is complete.
authornishanth
Fri, 02 Jul 2010 14:26:41 +0530
changeset 88 281c4bcf848f
parent 87 e81b105b1128
child 89 f8e25dea5222
now editing question is complete.
event/views.py
templates/edit_question.html
--- a/event/views.py	Fri Jul 02 14:12:25 2010 +0530
+++ b/event/views.py	Fri Jul 02 14:26:41 2010 +0530
@@ -219,7 +219,12 @@
         raise Http404
 
     if request.method == "POST":
-        pass
+        form = EditQuestionForm(request.POST, instance=q)
+        if form.is_valid():
+            form.save()
+            return redirect("/quiz/questions/list/%s"%ADMIN_KEY)
+        else:
+            return render_to_response("edit_question.html", {"form":form,"admin_key":ADMIN_KEY})
     else:
         form = EditQuestionForm(instance=q)
         return render_to_response("edit_question.html", {"form":form,"admin_key":ADMIN_KEY})
--- a/templates/edit_question.html	Fri Jul 02 14:12:25 2010 +0530
+++ b/templates/edit_question.html	Fri Jul 02 14:26:41 2010 +0530
@@ -1,4 +1,7 @@
 {% extends "base.html" %}
 {% block content %}
+<form method=post action="">
 {{form.as_p}}
+<input type=submit value=Update>
+</form>
 {% endblock %}