﻿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
7881	raw_id_fields and limit_choices_to with an __in query results in no output in popup list	Matthew Flanagan <mattimustang@…>	James Turk	"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.


"		closed	contrib.admin	dev		fixed			Accepted	1	0	0	0	0	0
