paginate(object_list, page, per_page, orphans=0, allow_empty_first_page=True)
Http404errors and validates if first page number was explictly defined in url parameter or not.
paginatefunction has certain requirements on handling views that use it. Firstly, views with pagination should have two links instead of one:
Pageobject defining following keys:
page- The 1-based page number for current page.
pages- The total number of pages.
count- The total number of items on list.
first- None if this is first page, otherwhise
previous- None if this is first page, otherwhise number of previous page.
next- None if this is last page, otherwhise number of next page.
last- None if this is last page, otherwhise number of the last page.
before- Total number of items on previous pages.
more- Total number of items left to display on next pages.
paginated_response(page, serializer=None, data=None, extra=None)
Pageobject, and following optional arguments:
serializer- Serializer to use. If its omited, no additional serialization step will be taken.
data- Data object to use. If its omited,
page.object_listwill be used by default.
extra- Dict with additional data to be included in response's JSON. Because dict in
extrais added to response via
response_json.update(extra), this dict can be used for last minute overrides as well.
pageargument default value of 1 will make
paginatefunction assume that first page was reached via link with explicit first page number and cause redirect loop.
misago.views.OutdatedSlugis raised. This exception is then captured by Misago's exception handler which makes Misago return permanent (http 301) redirect to client with valid link.
Http404exception raised by
OutdatedSlugexception raised by
validate_slug. This is by design. Both exceptions are handled by Misago for you so you don't have to spend time writing exception handling boiler plate on every view that fetches objects from database and validates their links.
validate_slugonly when request method is GET or HEAD.