#27003: ArrayField and JSONField form fields fail on already converted values
---------------------------------+----------------------------------
Reporter: brandonchinn178 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.10
Severity: Normal | Keywords: postgres, arrayfield
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
---------------------------------+----------------------------------
If I make a model `Foo` with the PostgreSQL `ArrayField`,
{{{
class Foo(models.Model):
bar = ArrayField(models.CharField(...))
}}}
And create a `ModelForm`:
{{{
FooForm = modelform_factory(Foo, excludes=[])
}}}
The field will fail with already-converted values, like
{{{
foo = Foo.objects.create(bar=['a', 'b'])
data = model_to_dict(foo) # {'bar': ['a', 'b']}
form = FooForm(instance=foo, data=data)
form.full_clean() # errors at django/contrib/postgres/forms/array.py:39
}}}
Shouldn't already converted values be checked in the `to_python` method of
`ArrayField`? (Same with `JSONField`)
--
Ticket URL: <https://code.djangoproject.com/ticket/27003>
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/058.6db984bf256fe6cd30288360917625fe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.