#20865 closed Bug (fixed)
admin raw_id_fields does not call value in limit_choices_to
Reported by: | Collin Anderson | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.6-beta-1 |
Severity: | Normal | Keywords: | |
Cc: | Collin Anderson | 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
The docs show that limit_choices_to
works with callables:
https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to
However, the raw_id_fields widget does not handle this correctly, and it generates a url like so:
/admin/auth/user/?last_login__lte=%3Cbuilt-in%20method%20today%20of%20type%20object%20at%200xb72cd440%3E
As far as I can tell, this has never worked correctly. I have a simple app that demonstrates the problem:
https://github.com/collinanderson/limit_choices_to/commit/8e30de93dea1908ae363b8556e3f89d36b031e79
Change History (6)
comment:1 by , 11 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Version: | master → 1.6-beta-1 |
comment:2 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 11 years ago
Needs tests: | unset |
---|
pull request now has a test https://github.com/django/django/pull/1442
comment:5 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I realize that we're discussing a new api for limit_choices_to, but in the meantime this should fix it:
https://github.com/django/django/pull/1442