charles-vdulac / django-roa

Fork of original Django ROA lib. Now ROA works directly with an API like Django Rest Framework
BSD 3-Clause "New" or "Revised" License
51 stars 25 forks source link

Fix pagination in remote querysets (checking limit_start/limit_stop) #16

Closed jathanism closed 10 years ago

jathanism commented 10 years ago

This fixes an issue with pagination when following links to subsequent pages (e.g. ?page=2), the results that are displayed are the same as on the first page. With this fix, pagination works properly and displays the correct set of results for each page.

I took the liberty of versioning this commit as 1.7.1 inside of setup.py.

charles-vdulac commented 10 years ago

Hi ! You PR brakes the Django Rest Framework tests (cf examples/django_rest_framework/README.md):

Default DRF list response is formatted as

{
  u'count': 1,
  u'next': None,
  u'previous': None,
  u'results': [{u'email': u'john@example.com', u'id': 1}]
}

so line data = data[limit_start:limit_stop] raises a TypeError exception.

Could you check this point ?

jathanism commented 10 years ago

Hey, thanks I'll take a look!

jathanism commented 10 years ago

@charles-vdulac I fixed this to work with the tests and the other case in which caused us to submit this patch in the first place. I also removed setup.py so you can increment the version yourself. :)

charles-vdulac commented 10 years ago

Thank you !