#35699: DatabaseOperations raise ValueError for valid GenericIPAddressField 
(inet)
value with psycopg3
-------------------------------------+-------------------------------------
     Reporter:  florianvazelle       |                    Owner:  (none)
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
  psycopg3,GenericIPAddressField     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

 * resolution:   => invalid
 * status:  new => closed

Comment:

 > I wasn't using Inet directly but through django, so it's missing some
 prior validations and indications, because the behavior changes between
 versions of psycopg.

 I'm not sure what kind of validation its missing

 {{{#!python
 >>> GenericIPAddressField().run_validators('192.168.1/24')
 ...
 ValidationError: ['Enter a valid IPv4 or IPv6 address.']
 }}}

 Obviously if you assign the string value directly to your model instance
 field and don't trigger
 [https://docs.djangoproject.com/en/5.1/ref/models/instances/#validating-
 objects model validation] values won't be validated on `save` just like
 assigning a non-email string to an `EmailField` without calling validation
 is allowed.

 I'm going to close this as invalid and suggest you have a look
 [https://github.com/jimfunk/django-postgresql-netfields at third-party
 librairies] that provide a field meeting your expectations.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35699#comment:4>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701918edf9e85-cf3e64bf-96d6-41ca-89bf-8b89582cccc0-000000%40eu-central-1.amazonses.com.

Reply via email to