﻿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
11028	Problem with searching in m2m fields in inherited model	Vitek Pliska	albertoconnor	"Models:
{{{

class Publishable(models.Model):
    ...
    authors = models.ManyToManyField(Author, verbose_name=_('Authors'))

class Article(Publishable):
    ...
}}}


and admin options like these:

{{{
class PublishableAdmin(admin.ModelAdmin):
    ...
    search_fields = ('title', 'description', 'slug', 'authors__name', 'authors__slug',)

class ArticleAdmin(PublishableAdmin):
    ...
}}}


Now, if we try search articles in admin, got this error:

{{{
ProgrammingError at /newman/articles/article/

invalid reference to FROM-clause entry for table ""core_publishable""
LINE 1: ..."") LEFT OUTER JOIN ""core_publishable_authors"" ON (""core_publ...
                                                             ^
HINT:  Perhaps you meant to reference the table alias ""t3"".
}}}
"	Bug	closed	contrib.admin	dev	Normal	worksforme	admin search inheritance		Accepted	1	0	0	1	0	0
