Opened 5 years ago

Last modified 5 years ago

#11028 new Bug

Problem with searching in m2m fields in inherited model

Reported by: vitek_pliska Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords: admin search inheritance
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



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".

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by julien

  • Severity set to Normal
  • Type set to Bug

comment:3 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:4 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

Add Comment

Modify Ticket

Change Properties
<Author field>
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.