# HG changeset patch # User nishanth # Date 1275128160 -19800 # Node ID 9db4ee082d4ea086e03d895251ce9e689fcb58ec # Parent 3932d9426c44efd4d7b4d5ad03fc3121909ca73f added topics choices and corresponding clean method diff -r 3932d9426c44 -r 9db4ee082d4e sdi/forms.py --- a/sdi/forms.py Sat May 29 15:39:55 2010 +0530 +++ b/sdi/forms.py Sat May 29 15:46:00 2010 +0530 @@ -6,7 +6,13 @@ """ The form that is displayed to user. """ - topics_interested = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=TOPICS_CHOICES) + topics_interested = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=TOPICS_CHOICES, required=False) class Meta: model = Registrant + def clean_topics_interested(self): + """ Join the choices using PIPE character and store them. + """ + + topics = self.cleaned_data['topics_interested'] + return "|".join(topics)