paginators.py(django-paging包):
try:
_page = EndlessPage(list(self.object_list[bottom:top]), number, self)
这一行给出了一个`TypeError:unhashable类型错误,尽管该object_list来自一个标准的QuerySet,可以与[bottom:top]一起使用而没有问题。
模板:
{% with paginate(request, my_queryset) as results %}
{{ results.paging }}
{% for result in results.objects %}
{{ result }}
{% endfor %}
{{ results.paging }}
{% endwith %}`
视图:
my_objects = BetterPaginator(queryset,25)
page = 1
context = { 'my_queryset': my_objects.get_context(page) }