#7881 closed (fixed)
raw_id_fields and limit_choices_to with an __in query results in no output in popup list
Reported by: | Owned by: | James Turk | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Here is a contrived example:
class Author(models.Model): name = models.CharField(max_length=64) class Book(models.Model): name = models.Charfield(max_length=64) author = models.ForeignKey(Author, limit_choices_to = {'name__in': ('Oscar','Hugo')}) class AuthorAdmin(admin.ModelAdmin): pass class BookAdmin(admin.ModelAdmin): raw_id_fields = ('author',) admin.site.register(Author, AuthorAdmin) admin.site.register(Book, BookAdmin)
>>> from models import Author >>> Author.objects.create(name='Oscar') >>> Author.objects.create(name='Matthew') >>> Author.objects.create(name='Hugo')
Now in the Admin when editing a Book if I click on the magnifying glass to select an Author then the list in the popup is empty. If I change BookAdmin to be:
class BookAdmin(admin.ModelAdmin): pass
then the select drop down lists the right options.
Attachments (1)
Change History (7)
comment:1 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
by , 16 years ago
Attachment: | raw_id_limit_choices_admin.diff added |
---|
comment:2 by , 16 years ago
Has patch: | set |
---|
comment:3 by , 16 years ago
milestone: | 1.0 beta → 1.0 |
---|
comment:5 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
small patches admin/views/main.py and admin/widgets.py fix this issue