Skip to content Skip to sidebar Skip to footer

Page() Takes 1 Positional Argument But 2 Were Given

I am trying to design an api for search functionality. Search is based on place name.What i want is localhost:8000/api/v1/rent/search/?format=json&q='california' but i am getti

Solution 1:

You're using a Tastypie Paginator class, which automatically detects the current page based on the requests passed in to it, unlike the Django Paginator class which requires you to pass in the page index.

Here's the code with relevant comments: https://github.com/django-tastypie/django-tastypie/blob/master/tastypie/paginator.py#L26

Try this:

    paginator = Paginator(request.GET, sqs, limit=20)

    try:
        page = paginator.page()
    except InvalidPage:
        raise Http404("Sorry, no results on that page.")

Post a Comment for "Page() Takes 1 Positional Argument But 2 Were Given"