Quantcast

[Django] #28108: new Pagination object create hit to database

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Django] #28108: new Pagination object create hit to database

Django
#28108: new Pagination object create hit to database
-------------------------------------+-------------------------------------
               Reporter:  Oleksandr  |          Owner:  nobody
  Shtalinberg                        |
                   Type:  Bug        |         Status:  new
              Component:  Core       |        Version:  1.11
  (Other)                            |
               Severity:  Normal     |       Keywords:  Pagination
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 This line      self._check_object_list_is_ordered()
 https://github.com/django/django/commit/c4980e28e57f385d8ffed5e32ce373e52ce61049
 #diff-bbce48ca2decf49cb1a52079680d2c3aR30
 create hit to database when I just create new Pagination object with
 Django 1.11

 https://travis-ci.org/shtalinberg/django-el-pagination/jobs/224166104
 Django 1.8-1.10 don't have that bug - all tests success

--
Ticket URL: <https://code.djangoproject.com/ticket/28108>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/054.5b6fca06656d296a5e9a5f6b91d4c128%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Django] #28108: new Pagination object create hit to database

Django
#28108: new Pagination object create hit to database
-------------------------------------+-------------------------------------
     Reporter:  Oleksandr            |                    Owner:  nobody
  Shtalinberg                        |
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Other)         |                  Version:  1.11
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  Pagination           |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

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


Comment:

 The extraneous query is executed when the `UnorderedObjectListWarning`
 message, which includes the queryset representation, is created as shown
 in your build.

 {{{
 test_num_queries
 (el_pagination.tests.templatetags.test_el_pagination_tags.LazyPaginateTest)
 ... /home/travis/build/shtalinberg/django-el-
 pagination/.tox/py27-dj111/lib/python2.7/site-
 packages/django/core/paginator.py:112: UnorderedObjectListWarning:
 Pagination may yield inconsistent results with an unordered object_list:
 <QuerySet [<TestModel: TestModel: 1>, <TestModel: TestModel: 2>,
 <TestModel: TestModel: 3>, <TestModel: TestModel: 4>, <TestModel:
 TestModel: 5>, <TestModel: TestModel: 6>, <TestModel: TestModel: 7>,
 <TestModel: TestModel: 8>, <TestModel: TestModel: 9>, <TestModel:
 TestModel: 10>, <TestModel: TestModel: 11>, <TestModel: TestModel: 12>,
 <TestModel: TestModel: 13>, <TestModel: TestModel: 14>, <TestModel:
 TestModel: 15>, <TestModel: TestModel: 16>, <TestModel: TestModel: 17>,
 <TestModel: TestModel: 18>, <TestModel: TestModel: 19>, <TestModel:
 TestModel: 20>, '...(remaining elements truncated)...']>
 }}}

 Making sure to pass an ordered set of objects to `paginate` should solve
 your issue.

 This could be done by adding `order_by('pk')` to the queryset your
 `make_model_instances()` [https://github.com/shtalinberg/django-el-
 pagination/blob/a156097afd8fb2be4075b4659a251f7deb954ada/el_pagination/tests/templatetags/test_el_pagination_tags.py#L87
 function returns].

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