# HG changeset patch # User nishanth # Date 1277983522 -19800 # Node ID 451be7b1de20e0d769f5fbd493d696616e2e0a0f # Parent 08af9e4ada788d4b057599ae840df4b6ec4d760b created form for editing and used it in view diff -r 08af9e4ada78 -r 451be7b1de20 event/forms.py --- a/event/forms.py Thu Jul 01 16:44:17 2010 +0530 +++ b/event/forms.py Thu Jul 01 16:55:22 2010 +0530 @@ -30,3 +30,8 @@ def clean_topics(self): return self.cleaned_data["topics"] + +class EditQuestionForm(forms.ModelForm): + + class Meta: + model = QuestionBank diff -r 08af9e4ada78 -r 451be7b1de20 event/views.py --- a/event/views.py Thu Jul 01 16:44:17 2010 +0530 +++ b/event/views.py Thu Jul 01 16:55:22 2010 +0530 @@ -207,7 +207,7 @@ for question in questions: question.topic_name = topic_num2name[question.topic] - return render_to_response("list_questions.html", {"questions":questions}) + return render_to_response("list_questions.html", {"questions":questions, "admin_key":ADMIN_KEY}) def edit_question(request, qid): """ Show the question and then edit it. @@ -218,5 +218,11 @@ except QuestionBank.DoesNotExist: raise Http404 + if request.medhod == "POST": + pass + else: + form = EditQuestionForm(q.get_values()) + return render_to_response("edit_question.html", {"form":form,"admin_key":ADMIN_KEY}) + diff -r 08af9e4ada78 -r 451be7b1de20 templates/list_questions.html --- a/templates/list_questions.html Thu Jul 01 16:44:17 2010 +0530 +++ b/templates/list_questions.html Thu Jul 01 16:55:22 2010 +0530 @@ -8,7 +8,7 @@ {% for question in questions %} - {{question.description}} + {{question.description}} {{question.topic_name}} {% endfor %}