martin-bts / askbot-devel

Askbot is a Django/Python Q&A forum. **Contributors README**: https://github.com/ASKBOT/askbot-devel#how-to-contribute. Commercial hosting of Askbot and support are available at https://askbot.com
Other
0 stars 2 forks source link

UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered #7

Closed sebastian-philipp closed 5 years ago

sebastian-philipp commented 5 years ago
/home/sebastian/Repos/askbot-devel/.tox/py2.7/local/lib/python2.7/site-packages/askbot/views/api_v1.py:121: 
UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'django.contrib.auth.models.User'> QuerySet.
  paginator = Paginator(users, 10)
martin-bts commented 5 years ago

For reference: https://stackoverflow.com/questions/44033670/python-django-rest-framework-unorderedobjectlistwarning

Since we do not define User, but import it from Django, we must "find all of the all, offset, filter, and limitclauses and add a order_byclause to them." (from the linked SE post)

RohanSingh07 commented 4 years ago

Please @martin-bts can you more clearly state how to add the order_by clause ?