#24092: New ArrayField from django.contrib.postgres.fields does not correctly 
save
an array of GenericIPAddressField
----------------------------------+--------------------
     Reporter:  smclenithan       |      Owner:
         Type:  Bug               |     Status:  new
    Component:  contrib.postgres  |    Version:  master
     Severity:  Normal            |   Keywords:
 Triage Stage:  Unreviewed        |  Has patch:  0
Easy pickings:  0                 |      UI/UX:  0
----------------------------------+--------------------
 ArrayField throws an error when using an array of GenericIPAddressField as
 the base_field:

 {{{
 from django.contrib.postgres.fields import ArrayField

 class MyModel(models.Model):
     ips = ArrayField(base_field=models.GenericIPAddressField(),
 db_index=True)
 }}}

 {{{
 >>> test = MyModel()
 >>> test.ips = ['10.2.3.4', '1.2.3.4']
 >>> test.save()

 ... truncated...

 django.db.utils.ProgrammingError: column "ips" is of type inet[] but
 expression is of type text[]
 LINE 1: ...story" SET "model_id" = 1, "ips" = ARRAY['10...
 }}}

 There also appears to be an issue, when reading from the model (where
 inet[] data was set in the db itself), instead of a string array of IPs
 being returned we get this:
 {{{
 >>> test.ips
 '{10.2.3.4, 1.2.3.4}'
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24092>
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/054.f9d647248fba035f10df2afdeea77f81%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to