Skip to content

Commit

Permalink
Fixes #3 (broken submit_faq view) by adding a topic field.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikek authored and jacobian committed May 9, 2011
1 parent 3d3d89a commit 65ea9f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions faq/forms.py
Expand Up @@ -8,10 +8,11 @@

import datetime
from django import forms
from faq.models import Question
from faq.models import Question, Topic
from faq.enums import STATUS_INACTIVE

class SubmitFAQForm(forms.Form):
topic = forms.ModelChoiceField(queryset=Topic.objects.all(), empty_label=None)
question = forms.CharField(max_length=512,min_length=4,widget=forms.Textarea)
answer = forms.CharField(required=False,widget=forms.Textarea)

Expand All @@ -27,8 +28,10 @@ def save(self, user=None):
dt.hour, dt.minute, dt.second )
question = self.cleaned_data['question']
answer = self.cleaned_data['answer']
topic = self.cleaned_data['topic']
new_question = Question( text=question, answer=answer,
slug=slug_str, sort_order = 999,
protected = False, status = STATUS_INACTIVE )
protected = False, status = STATUS_INACTIVE,
topic=topic )
return new_question

0 comments on commit 65ea9f9

Please sign in to comment.