Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample code causes exception #37

Open
bifocalpirate opened this issue Apr 23, 2016 · 2 comments
Open

sample code causes exception #37

bifocalpirate opened this issue Apr 23, 2016 · 2 comments

Comments

@bifocalpirate
Copy link

bifocalpirate commented Apr 23, 2016

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
Copy link

I had this same issue, and updated it. Now getting another new error. On to the next! Thanks for posting @skrillex581!

@th3goose
Copy link

th3goose commented Jul 19, 2017

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants