diff options
author | hardythe1 | 2012-03-22 16:56:22 +0530 |
---|---|---|
committer | hardythe1 | 2012-03-22 16:56:22 +0530 |
commit | b1ba290f249d84989cb3cc38d018482794582a46 (patch) | |
tree | a0503ec456315e035c515b7dfb881e714a1d4599 /testapp/exam/forms.py | |
parent | 4884af693bfb0b9bb70ed6b3d8489267a86d90f9 (diff) | |
download | online_test-b1ba290f249d84989cb3cc38d018482794582a46.tar.gz online_test-b1ba290f249d84989cb3cc38d018482794582a46.tar.bz2 online_test-b1ba290f249d84989cb3cc38d018482794582a46.zip |
Autocomplete tagging functionality
Diffstat (limited to 'testapp/exam/forms.py')
-rw-r--r-- | testapp/exam/forms.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/testapp/exam/forms.py b/testapp/exam/forms.py index 1a25312..a6844bb 100644 --- a/testapp/exam/forms.py +++ b/testapp/exam/forms.py @@ -3,7 +3,11 @@ from exam.models import Profile,Quiz,Question from django.contrib.auth import authenticate from django.contrib.auth.models import User -from taggit.forms import * +from taggit.managers import TaggableManager +from taggit.forms import TagField +from taggit_autocomplete_modified.managers import TaggableManagerAutocomplete +from taggit_autocomplete_modified.widgets import TagAutocomplete +from taggit_autocomplete_modified import settings from string import letters, punctuation, digits import datetime @@ -113,6 +117,7 @@ class QuizForm(forms.Form): start_date = forms.DateField(initial=datetime.date.today) duration = forms.IntegerField() active = forms.BooleanField(required = False) + tags = TagField(widget=TagAutocomplete()) description = forms.CharField(max_length=256, widget=forms.Textarea(attrs={'cols':20,'rows':1})) def save(self): @@ -138,7 +143,7 @@ class QuestionForm(forms.Form): options = forms.CharField(widget = forms.Textarea(attrs={'cols': 40, 'rows': 1}),required=False) type = forms.CharField(max_length=8, widget=forms.Select(choices=QUESTION_TYPE_CHOICES)) active = forms.BooleanField(required=False) - tags = TagField() + tags = TagField(widget=TagAutocomplete(),required=False) def save(self): summary = self.cleaned_data["summary"] |