Opened 9 years ago
Closed 9 years ago
#28108 closed Bug (invalid)
new Pagination object create hit to database
| Reported by: | Oleksandr Shtalinberg | Owned by: | nobody | 
|---|---|---|---|
| Component: | Core (Other) | Version: | 1.11 | 
| Severity: | Normal | Keywords: | Pagination | 
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
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
  Note:
 See   TracTickets
 for help on using tickets.
    
The extraneous query is executed when the
UnorderedObjectListWarningmessage, which includes the queryset representation, is created as shown in your build.Making sure to pass an ordered set of objects to
paginateshould solve your issue.This could be done by adding
order_by('pk')to the queryset yourmake_model_instances()function returns.