#27864: Limit the number of terms in an admin search
--------------------------------------+------------------------------------
     Reporter:  VINAY KUMAR SHARMA    |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  contrib.admin         |                  Version:  1.8
     Severity:  Normal                |               Resolution:
     Keywords:  mysql                 |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Description changed by Anton Samarchyan:

Old description:

> Found this bug when searching with long string:
>
> OperationalError at /posts/posts
>
> (1116, 'Too many tables; MySQL can only use 61 tables in a join')
>

> {{{
> Request URL:
> http://cms.example.com/posts/posts/?q=Deliverable++TRC+Promo+%282+Options%29+Visual+Snapshot++%28Montage%29+How+do+you+know+your+reward+Strategy+is+working%3F+Masterclass%3A+Consumerization+of+Total+Rewards%3A+Superhero%27s+Toolkit+Alignment%2C+Management+and+Governance+of+%E2%80%98Executive+Pay%E2%80%99+and+Long+Term+Incentives+Award+Ceremony%3A+League+Awards+-Total+Rewards+2017+%22Masterclass%3AMotivating+your+Internal+Customers++Part+II%3A+A+Communication+Toolkit+by+Preeti+Gupta%2C+Aditya+Birla+Group
> }}}
>

> I've created an CMS system using Django Admin, where models Posts is in
> app Posts.
>
> Model Posts has an **M2M** field `authors`, and this field I've included
> in search for `admin.ModelAdmin`:
>
> e.g here:
>
> {{{
> # models.py
> @python_2_unicode_compatible
> class Posts(models.Model):
>     id = models.AutoField(primary_key=True, db_column='article_id')
>     #
>     # ... other fields ...
>     #
>     # Related M2M/Foreign Key fields
>     authors = models.ManyToManyField(Author, through='PostAuthors',
>                                      through_fields=('post', 'author'))
>     subcategories = models.ManyToManyField(SubCategory,
> through='PostSubcategory',
>                                            through_fields=('post',
> 'subcategory'))
>
> # admin.py
> @admin.register(Posts)
> class PostsAdmin(admin.ModelAdmin):
>     actions = [delete_selected, republish_selected, add_to_top_stories]
>     list_per_page = ADMIN_LIST_PER_PAGE
>     list_filter = [PostTypeListFilter, 'datetime', 'is_active',
> 'is_deleted']
>     search_fields = ['authors__name', 'title']
> }}}

New description:

 Found this bug when searching with long string:

 OperationalError at /posts/posts

 (1116, 'Too many tables; MySQL can only use 61 tables in a join')


 {{{
 Request URL:
 
http://cms.example.com/posts/posts/?q=Deliverable++TRC+Promo+%282+Options%29+Visual+Snapshot++%28Montage%29+How+do+you+know+your+reward+Strategy+is+working%3F+Masterclass%3A+Consumerization+of+Total+Rewards%3A+Superhero%27s+Toolkit+Alignment%2C+Management+and+Governance+of+%E2%80%98Executive+Pay%E2%80%99+and+Long+Term+Incentives+Award+Ceremony%3A+League+Awards+-Total+Rewards+2017+%22Masterclass%3AMotivating+your+Internal+Customers++Part+II%3A+A+Communication+Toolkit+by+Preeti+Gupta%2C+Aditya+Birla+Group
 }}}


 I've created a CMS system using Django Admin, where models Posts is in app
 Posts.

 Model Posts has an **M2M** field `authors`, and this field I've included
 in search for `admin.ModelAdmin`:

 e.g here:

 {{{
 # models.py
 @python_2_unicode_compatible
 class Posts(models.Model):
     id = models.AutoField(primary_key=True, db_column='article_id')
     #
     # ... other fields ...
     #
     # Related M2M/Foreign Key fields
     authors = models.ManyToManyField(Author, through='PostAuthors',
                                      through_fields=('post', 'author'))
     subcategories = models.ManyToManyField(SubCategory,
 through='PostSubcategory',
                                            through_fields=('post',
 'subcategory'))

 # admin.py
 @admin.register(Posts)
 class PostsAdmin(admin.ModelAdmin):
     actions = [delete_selected, republish_selected, add_to_top_stories]
     list_per_page = ADMIN_LIST_PER_PAGE
     list_filter = [PostTypeListFilter, 'datetime', 'is_active',
 'is_deleted']
     search_fields = ['authors__name', 'title']
 }}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27864#comment:7>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.423e919ab839c8c807762c0a451e113f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to