1

I'm having trouble using djangoś paginator function. In this question i can't find the solution: Django: Paginator + raw SQL query

With Table.object.all() i have no trouble, but with raw sql i receive the error object of type 'RawQuerySet' has no len()

I tried also

num = len(list(ads)) paginator = Paginator(num, 2)

and i receive object of type 'int' has no len(). I tried to print num and it contains the correct number so i don't understand why paginator doesn't like it. Hope someone can help.

4

1 回答 1

1

在这里找到解决方案:http ://groups.google.com/group/django-users/browse_thread/thread/42cf7b5a88f31b9c

这意味着:

paginator = Paginator((list(ads)), 10)
于 2012-04-19T01:06:13.733 回答