Revision [913]
Last edited on 2008-05-31 17:15:03 by KlenwellAdminAdditions:
# extending charField with own class that overrides clean method (used for validation) so that
# it requires two items be picked from list
class PickTwoField(forms.CharField):
def clean(self, value):
if len(value) != 2:
raise forms.ValidationError('Please select two (2) choices below')
return value
picktwo = PickTwoField(widget=forms.CheckboxSelectMultiple(choices=CHOICES_PICKTWO))
# it requires two items be picked from list
class PickTwoField(forms.CharField):
def clean(self, value):
if len(value) != 2:
raise forms.ValidationError('Please select two (2) choices below')
return value
picktwo = PickTwoField(widget=forms.CheckboxSelectMultiple(choices=CHOICES_PICKTWO))
Deletions:
Revision [911]
Edited on 2008-05-31 10:36:55 by KlenwellAdminAdditions:
('fast',"fast"),
('cheap',"cheap"),
('works',"works")
('cheap',"cheap"),
('works',"works")
Deletions:
('CHEAP',"cheap"),
('WORKS',"works")
Revision [910]
Edited on 2008-05-31 10:36:30 by KlenwellAdminAdditions:
===Widget Overriding===
Deletions:
Revision [909]
Edited on 2008-05-31 10:35:35 by KlenwellAdminAdditions:
return to [[CategoryGoogleAppEngine Google App Engine home]]
# set choice list: notice that we require a tuple of tuples containing both value and label items
# the google examples gave me the impression you could use a 1-D sequence
# NOTE: we have to explicitly pass our choice list as a key argument to our widget constructor
model = DemoModel
# set choice list: notice that we require a tuple of tuples containing both value and label items
# the google examples gave me the impression you could use a 1-D sequence
# NOTE: we have to explicitly pass our choice list as a key argument to our widget constructor
model = DemoModel
Deletions:
# the google examples gave me the impress you could use a 1-D sequence
# NOTE: we have to explicit pass our choice list as a key argument to our widget constructor
model = DemoMode