Opened 9 years ago

Closed 9 years ago

#24078 closed Bug (fixed)

GenericIPAddressField is inconsistent with nulls

Reported by: Josh Smeaton Owned by: Josh Smeaton
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

IP Addresses are stored as inet on postgres, so the empty string isn't allowed. Instead, any empty strings are converted to nulls.

Oracle will then convert that null to the empty string once it's retrieved, because GenericIPAddressField.empty_strings_allowed = True. Other backends will return None.

I think the right thing to do is set empty_strings_allowed = False on GenericIPAddressField, but I'm not sure if that'll have other implications. I'll put together a patch later today.

Change History (4)

comment:1 by Josh Smeaton, 9 years ago

Owner: changed from nobody to Josh Smeaton
Status: newassigned

comment:2 by Josh Smeaton, 9 years ago

Has patch: set
Triage Stage: UnreviewedReady for checkin

See PR https://github.com/django/django/pull/3840

Not sure if release notes are required, or if this could be considered a backwards incompatible change.

comment:3 by Loic Bistuer, 9 years ago

All bug fixes are backwards incompatible by nature, I don't think release notes are required here.

LGTM.

comment:4 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 5a4ac4ead986387216e0c0e1b4d4b6a537f87e0b:

Fixed #24078 -- Removed empty strings from GenericIPAddressField

Note: See TracTickets for help on using tickets.
Back to Top