#34818: GenericIPAddressField ValidationError incorrect message when both
protocols
present
-------------------------------------------+------------------------
Reporter: minusf | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
It seems that the `invalid` code for `GenericIPAddressField` models gets
clobbered when both protocols are present in a model:
{{{
class Site(models.Model):
ipv6 = models.GenericIPAddressField(protocol="IPv6")
ipv4 = models.GenericIPAddressField(protocol="IPv4")
}}}
{{{
>>> site = Site(ipv6="6", ipv4="4")
>>> site.full_clean()
raceback (most recent call last):
File "<console>", line 1, in <module>
File "/src/tmp/ip_bug/venv/lib/python3.10/site-
packages/django/db/models/base.py", line 1502, in full_clean
raise ValidationError(errors)
django.core.exceptions.ValidationError: {'ipv6': ['Enter a valid IPv4
address.'], 'ipv4': ['Enter a valid IPv4 address.']}
}}}
sometimes the other message wins:
{{{
ValidationError: {'ipv6': ['Enter a valid IPv6 address.'], 'ipv4': ['Enter
a valid IPv6 address.']}
}}}
p.s. not sure about the component, perhaps could be "Database Layer:
Models" or "Error reporting"?
--
Ticket URL: <https://code.djangoproject.com/ticket/34818>
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/0107018a6ff49aa6-7e153824-780a-4c97-a6ca-ccbbdc5bbdf7-000000%40eu-central-1.amazonses.com.