Re: [Django] #35569: Misleading ValidationError wording from `limit_choices_to` violation

7 views
Skip to first unread message

Django

unread,
Jul 1, 2024, 11:12:45 AM (4 days ago) Jul 1
to django-...@googlegroups.com
#35569: Misleading ValidationError wording from `limit_choices_to` violation
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* stage: Unreviewed => Accepted

Comment:

Changing the logic to disambiguate between "not exists" and "not matching"
would require a non-negligible amount of work (we'd have to annotate the
`limits_choice_to` criteria and check its value instead of simply doing
`queryset = queryset.complex_filter(...)`) and introduces undesirable
existence disclosure as you brought up.

Switching the validation error message to "not a valid choice" makes sense
though as it prevents disclosure,
[https://github.com/django/django/blob/289f48c71b0fdd058defb29879368897fb837021/django/db/models/fields/related.py#L931C5-L933
is not an invasive patch], and quite frankly is a better user error
message.
--
Ticket URL: <https://code.djangoproject.com/ticket/35569#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 3, 2024, 7:55:25 AM (2 days ago) Jul 3
to django-...@googlegroups.com
#35569: Misleading ValidationError wording from `limit_choices_to` violation
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 0 => 1

Comment:

[https://github.com/django/django/pull/18338 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/35569#comment:3>

Django

unread,
Jul 4, 2024, 2:41:55 AM (yesterday) Jul 4
to django-...@googlegroups.com
#35569: Misleading ValidationError wording from `limit_choices_to` violation
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35569#comment:4>

Django

unread,
Jul 4, 2024, 5:35:13 AM (yesterday) Jul 4
to django-...@googlegroups.com
#35569: Misleading ValidationError wording from `limit_choices_to` violation
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: closed
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"31837dbcb36f1ab57fb1b16cb0b126c55a1bdf01" 31837db]:
{{{#!CommitTicketReference repository=""
revision="31837dbcb36f1ab57fb1b16cb0b126c55a1bdf01"
Fixed #35569 -- Improved wording of invalid ForeignKey error message.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35569#comment:5>
Reply all
Reply to author
Forward
0 new messages