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 26279,Admin search_fields doesn't support nested lookup from JSONField,Nicolas Delaby,nobody,"Model {{{ class Foo(models.Model): json = JSONField() }}} Admin {{{ @admin.register(Foo) class FooAdmin(admin.ModelAdmin): search_fields = ('json__key',) }}} request from the browser (enter anything in search box). {{{GET /admin/project/foo/?q=123}}} I get this error {{{ File ""/home/.virtualenvs/project/lib/python3.4/site-packages/django/contrib/admin/views/main.py"", line 356, in get_queryset request, qs, self.query) File ""/home/.virtualenvs/project/lib/python3.4/site-packages/django/contrib/admin/options.py"", line 903, in get_search_results if lookup_needs_distinct(self.opts, search_spec): File ""/home/.virtualenvs/project/lib/python3.4/site-packages/django/contrib/admin/utils.py"", line 32, in lookup_needs_distinct import pdb; pdb.set_trace() File ""/home/.virtualenvs/project/lib/python3.4/site-packages/django/db/models/options.py"", line 582, in get_field raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, field_name)) django.core.exceptions.FieldDoesNotExist: Foo has no field named 'key' }}} I'll be glad to have some guidance where is the best place to write the test. Then I can work on making a fix.",Bug,closed,contrib.admin,1.9,Normal,duplicate,admin,,Unreviewed,0,0,0,0,0,0