sample code causes exception
Opened this issue · 2 comments
bifocalpirate commented
Code the in usage example (in views.py) says Paginator accepts the request object as a parameter. This causes an__init__() takes 3 arguments
exception. After checking the source it looks like it should be
p = Paginator(suburb_list, per_page=10)
which is also what ended up working for me.
Additionally the sample code for the Generic Class-Based View sets an object property as the model type, it should set the model property instead. As in
class MyModelListView(PaginationMixin, ListView):
# Important, this tells the ListView class we are paginating
paginate_by = 10
# Replace it for your model or use the queryset attribute instead
model = MyModel
th3goose commented
I had this same issue, and updated it. Now getting another new error. On to the next! Thanks for posting @skrillex581!
th3goose commented
@skrillex581 I also think the try/catch block should be updated or EmptyPage otherwise whats the point of importing it...
try:
page = request.GET.get('page', 1)
except PageNotAnInteger or EmptyPage:
page = 1