#26283: SplitArrayField failed to validate because remove_trailing_nulls doesn't
work properly
----------------------------------+-----------------
     Reporter:  mochawich         |      Owner:
         Type:  Bug               |     Status:  new
    Component:  contrib.postgres  |    Version:  1.8
     Severity:  Normal            |   Keywords:
 Triage Stage:  Unreviewed        |  Has patch:  0
Easy pickings:  0                 |      UI/UX:  0
----------------------------------+-----------------
 I have this form

 {{{
 class CategoryForm(forms.ModelForm):
     filters = SplitArrayField(SlugField(required=False), required=False,
 size=10, remove_trailing_nulls=True)
 }}}

 When I try to submit it without any values it fails with the error: "Item
 0 in the array did not validate:"
 The reason is that on this line 181 in contrib.postgres.forms.array.py

 {{{
             if null_index:
                 cleaned_data = cleaned_data[:null_index]

 }}}

 Obviously in my case the null_index is 0, therefore the `cleaned_data` is
 returned as `[u'', u'', u'', u'', u'', u'', u'', u'', u'', u'']` which
 fails to look like an `empty_values` on line 1188 in db.models.base.py

--
Ticket URL: <https://code.djangoproject.com/ticket/26283>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.efdbe489ecb13878c31fcf4653ceaa67%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to