From b1ba290f249d84989cb3cc38d018482794582a46 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Thu, 22 Mar 2012 16:56:22 +0530 Subject: Autocomplete tagging functionality --- testapp/exam/forms.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'testapp/exam/forms.py') 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"] -- cgit