event/views.py
changeset 85 451be7b1de20
parent 84 08af9e4ada78
child 86 404e9c1b8cff
equal deleted inserted replaced
84:08af9e4ada78 85:451be7b1de20
   205     questions = QuestionBank.objects.all()
   205     questions = QuestionBank.objects.all()
   206     topic_num2name = dict(TOPIC_CHOICES)
   206     topic_num2name = dict(TOPIC_CHOICES)
   207 
   207 
   208     for question in questions:
   208     for question in questions:
   209         question.topic_name = topic_num2name[question.topic]
   209         question.topic_name = topic_num2name[question.topic]
   210     return render_to_response("list_questions.html", {"questions":questions})
   210         return render_to_response("list_questions.html", {"questions":questions, "admin_key":ADMIN_KEY})
   211 
   211 
   212 def edit_question(request, qid):
   212 def edit_question(request, qid):
   213     """ Show the question and then edit it.
   213     """ Show the question and then edit it.
   214     """
   214     """
   215 
   215 
   216     try:
   216     try:
   217         q = QuestionBank.objects.get(id=qid)
   217         q = QuestionBank.objects.get(id=qid)
   218     except QuestionBank.DoesNotExist:
   218     except QuestionBank.DoesNotExist:
   219         raise Http404
   219         raise Http404
   220 
   220 
   221 
   221     if request.medhod == "POST":
   222 
   222         pass
       
   223     else:
       
   224         form = EditQuestionForm(q.get_values())
       
   225         return render_to_response("edit_question.html", {"form":form,"admin_key":ADMIN_KEY})
       
   226 
       
   227 
       
   228