author | nishanth |
Sat, 29 May 2010 15:46:00 +0530 | |
changeset 20 | 9db4ee082d4e |
parent 19 | 3932d9426c44 |
child 21 | 3d7a52d9ed2e |
permissions | -rw-r--r-- |
8 | 1 |
from django import forms |
2 |
||
19 | 3 |
from sage_days.sdi.models import Registrant, TOPICS_CHOICES |
8 | 4 |
|
5 |
class RegisterForm(forms.ModelForm): |
|
6 |
""" The form that is displayed to user. |
|
7 |
""" |
|
8 |
||
20
9db4ee082d4e
added topics choices and corresponding clean method
nishanth
parents:
19
diff
changeset
|
9 |
topics_interested = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=TOPICS_CHOICES, required=False) |
8 | 10 |
class Meta: |
11 |
model = Registrant |
|
19 | 12 |
|
20
9db4ee082d4e
added topics choices and corresponding clean method
nishanth
parents:
19
diff
changeset
|
13 |
def clean_topics_interested(self): |
9db4ee082d4e
added topics choices and corresponding clean method
nishanth
parents:
19
diff
changeset
|
14 |
""" Join the choices using PIPE character and store them. |
9db4ee082d4e
added topics choices and corresponding clean method
nishanth
parents:
19
diff
changeset
|
15 |
""" |
9db4ee082d4e
added topics choices and corresponding clean method
nishanth
parents:
19
diff
changeset
|
16 |
|
9db4ee082d4e
added topics choices and corresponding clean method
nishanth
parents:
19
diff
changeset
|
17 |
topics = self.cleaned_data['topics_interested'] |
9db4ee082d4e
added topics choices and corresponding clean method
nishanth
parents:
19
diff
changeset
|
18 |
return "|".join(topics) |