#5622: Empty ipaddress raises an error (invalid input syntax for type inet: "")
-----------------------------+-----------------------------------------
     Reporter:  anonymous    |                    Owner:  aashu_dwivedi
         Type:  Bug          |                   Status:  assigned
    Component:  Forms        |                  Version:  master
     Severity:  Normal       |               Resolution:
     Keywords:  sprintdec01  |             Triage Stage:  Accepted
    Has patch:  1            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  1
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+-----------------------------------------

Comment (by kace):

 For users facing this irritating issue, there is a quick, effective work-
 around (based on one of toke's patches (thank you)).  Put this into
 "models.py":
 {{{
 class IPAddressFieldNullable(models.IPAddressField) :
     def get_db_prep_save(self, value):
         return value or None
 }}}
 Then change your IP attribute to use this modified field.  E.g.:
 {{{
 -   someip = models.IPAddressField(blank=True, null=True )
 +   someip = IPAddressFieldNullable(blank=True, null=True )
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/5622#comment:54>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to