I got an alike problem, I ran through the docs, mailing lists, etc.
but no solution.
I got:
class LinkForm(forms.Form):
TYPE_CHOICES = (
('user', _('User link')),
('url', _('Web link')),
)
type = forms.ChoiceField(choices=TYPE_CHOICES)
user = forms.IntegerField(required=False)
url = forms.URLField(required=False, initial='http://')
I want to validate the url-field _only_ when the type-field is set to
"url" otherwise I don't, and I also don't want to get errors thrown
otherwise!
But since the Field's clean() method is called first the URL always
gets validated :-(
So I have no chance to modify the url-Field to an empty string using
the various clean-methods.
Is overriding the __init__() and putting the logic in there my only chance?
Or did I miss something here?
--
cu
Wolfram
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---