chibisov / drf-extensions

DRF-extensions is a collection of custom extensions for Django REST Framework
http://chibisov.github.io/drf-extensions/docs
MIT License
1.47k stars 208 forks source link

Added page no pagination support. #130

Closed tevinjoseph closed 8 years ago

tevinjoseph commented 8 years ago

Added page no pagination support. The default PaginationKeyBit wasn't working for me.

auvipy commented 8 years ago

you will need to add test and docs too :)

tevinjoseph commented 8 years ago

@auvipy I have updated the doc. I will add the test soon.

chibisov commented 8 years ago

@tevinjoseph what problems did you have with PaginationKeyBit? As I see, you've made the same thing.

tevinjoseph commented 8 years ago

@chibisov If we didn't pass page_size parameter and call API using api/news/?page=2 , the default PaginationKeyBit doesn't work.

chibisov commented 8 years ago

I believe you should dig to PaginationKeyBit. It could be a bug for your version of DRF. As I can see from tests PaginationKeyBit should work without page_size argument https://github.com/chibisov/drf-extensions/blob/master/tests_app/tests/unit/key_constructor/bits/tests.py#L355

tevinjoseph commented 8 years ago

@chibisov I'm using djangorestframework==3.2.2. There won't be any error if we use the default PaginationKeyBit, but for every page, it returns the result in the first page. That is, I get the result of api/news/?page=1, even if I'm calling api/news/?page=3

chibisov commented 8 years ago

@tevinjoseph that the bug of PaginationKeyBit. It's better to fix it.

tevinjoseph commented 8 years ago

@chibisov Ok, I will try to fix it and come up with a new pull request. Is that okay?