#11028: Problem with searching in m2m fields in inherited model
-------------------------------------+-------------------------------------
     Reporter:  Vitek Pliska         |                    Owner:
                                     |  albertoconnor
         Type:  Bug                  |                   Status:  closed
    Component:  contrib.admin        |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  admin search         |  worksforme
  inheritance                        |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon):

 * status:  new => closed
 * resolution:   => worksforme


Comment:

 I haven't been able to reproduce the initial issue.

 I tried with the following models/modeladmins:
 {{{#!python
 class Author(models.Model):
     name = models.CharField(max_length=200, default='<name>')
     slug = models.SlugField()

 class Publishable(models.Model):
     title = models.CharField(max_length=50, default='<title>')
     slug = models.SlugField()
     description = models.CharField(max_length=200,
 default='<description>')
     authors = models.ManyToManyField(Author, verbose_name=('Authors'))

 class Article(Publishable):
     pass


 class PublishableAdmin(admin.ModelAdmin):
     search_fields = ('authors__name', 'authors__slug',)

 class ArticleAdmin(PublishableAdmin):
     pass
 }}}

 (Because the initial report wasn't very clear, I even tried making
 `Publishable` an abstract model but that didn't seem to change anything).

 With this setup, I would start `runserver`, navigate to the `Article`
 admin and start a search, expecting to see the reported error.
 I tried various versions of Django (including all tagged 1.0.X releases
 since 1.0 was the latest release at the time of the report) but I could
 never trigger any error while doing a search.


 The testcase that's attached earlier in the ticket doesn't actually track
 this issue. It uses `self.assertRaises(Exception)` which is too broad and
 ends up catching an `AttributeError` on `m.list_max_show_all` just before
 that attribute is introduced (which explains why it uncovers
 cf70c96ce08bec8834ada695451cc915f7558dbd).


 Given this and the fact that this ticket has seen very little activity
 over the years, I'm going to close it.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/11028#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.c5cae47f01315e2438be6a2e347900a4%40djangoproject.com.

Reply via email to