#12752: validators should allow check against empty to be customized
------------------------------------------+---------------------------------
Reporter: shauncutts | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.2-alpha
Keywords: | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
I have a custom field, which sets up a correspondence between a numpy
array and a postgres array. It mostly seems to be working. However, when I
call .full_clean() on a model containing such a field, the validation code
eventually calls:
django.db.models.fields.__init__.py(207)validate():
{{{
206
207 -> if not self.blank and value in validators.EMPTY_VALUES:
208 raise
exceptions.ValidationError(self.error_messages['blank'])
}}}
Here, the numpy definition for equality snarls things, and I get:
{{{
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
}}}
I suggest a {{{ django.db.models.Field }}} member {{{ is_empty }}} be
added, which does {{{ value in validators.EMPTY_VALUES }}} by default, but
can be overridden by a custom subclass.
--
Ticket URL: <http://code.djangoproject.com/ticket/12752>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en.