﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34818	GenericIPAddressField ValidationError incorrect message when both protocols present	minusf	Parth Verma	"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()
Traceback (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""?"	Bug	closed	Database layer (models, ORM)	4.2	Normal	fixed			Ready for checkin	1	0	0	0	0	0
