On Oct 12, 10:52 pm, Daniel Roseman <
dan...@roseman.org.uk> wrote:
> You'll have to show some code. How are you creating the page object?
hotels =
Hotel.objects.select_related().filter(is_deleted=False).filter(...)...
paginator = Paginator(hotels[:200], items_per_page)
try: page = int(request.GET.get('page', '1'))
except ValueError: page = 1
try:
hotel_list =
paginator.page(page)
except (EmptyPage, InvalidPage):
hotel_list =
paginator.page(paginator.num_pages)
print hotel_list.paginator.num_pages # yields 11, which is expected
for the query
print hotel_list # yields "Page 1 of 11", which is again expected
print hotel_list.object_list # yields [], WTF
I resolved the problem meanwhile by simply reverting the DB to an
older state, seems like there was something wrong with the data
consistency there.
But still I'd like to know how it's possible that Paginator behaves
like this.