﻿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
35569	Misleading ValidationError wording from `limit_choices_to` violation	Jacob Walls	Jacob Walls	"The ValidationError raised when a choice violating `ForeignKey.limit_choices_to` is made refers to an instance ""not existing"", when in reality, the instance may exist but is simply not an allowed choice.

With the [https://docs.djangoproject.com/en/4.2/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to example field]:
{{{
In [5]: Person(staff_member_id=2).full_clean()
---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
Cell In[5], line 1
----> 1 Person(staff_member_id=2).full_clean()

File ~/release/lib/python3.12/site-packages/django/db/models/base.py:1502, in Model.full_clean(self, exclude, validate_unique, validate_constraints)
   1499         errors = e.update_error_dict(errors)
   1501 if errors:
-> 1502     raise ValidationError(errors)

ValidationError: {'staff_member': ['user instance with id 2 does not exist.']}

In [6]: User.objects.get(id=2)
Out[6]: <User: anonymous>
}}}

We could use wording like ""not a valid choice"" and reuse that wording for nonexistent instances as well if there is a disclosure concern about introducing a distinction between the two cases."	Cleanup/optimization	closed	Database layer (models, ORM)	4.2	Normal	fixed			Ready for checkin	1	0	0	0	0	0
