One question, validators are supposed to get deprecated once the new forms becomes the default.
How do we use the newforms validation to do this? Ramdas
On 1/8/07, Brian Beck <[EMAIL PROTECTED]> wrote: > > > Couple more things I discovered... > > This page documents a RequiredIfOtherFieldsNotGiven validator that > doesn't actually exist! > http://www.djangoproject.com/documentation/forms/#validators (it's > close to what you want but not exactly -- you want it to be required if > *neither* of the other fields are given). > > Maybe I'll submit a patch that actually adds both to > django.core.validators.. . > > Anyway, I thought of a better way to write that validator! Scrap that > class and import... > > def RequiredIfNoneGiven(other_fields, error_message=None): > from django.core.validators import RequiredIfOtherFieldNotGiven, > AnyValidator, gettext_lazy > from django.utils.text import get_text_list > if error_message is None: > error_message = "If this field is not given, %s must be given." > % get_text_list(other_fields) > validators = [RequiredIfOtherFieldNotGiven(field) for field in > other_fields] > return AnyValidator(validators, gettext_lazy(error_message)) > > > > > >
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

