Problem with searching in m2m fields in inherited model
|Reported by:||vitek_pliska||Owned by:||albertoconnor|
|Severity:||Normal||Keywords:||admin search inheritance|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
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".
Change History (9)
comment:1 Changed 7 years ago by Alex
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:5 Changed 17 months ago by albertoconnor
- Owner changed from nobody to albertoconnor
- Status changed from new to assigned
Changed 17 months ago by albertoconnor
comment:7 Changed 17 months ago by albertoconnor
- Resolution set to fixed
- Status changed from assigned to closed