duck.contrib.responses.template_responseΒΆ
This module provides a shortcut to create a better-mid response with a given response class and icon link.
Module ContentsΒΆ
FunctionsΒΆ
Transforms a basic response like HttpServerErrorResponse into a nicer Duck response. |
DataΒΆ
APIΒΆ
- duck.contrib.responses.template_response.FAVICONΒΆ
None
- duck.contrib.responses.template_response.template_response(response_class: Type[duck.http.response.HttpResponse], title: str = None, heading: str = None, body: str = None, icon_link=FAVICON, icon_type='image/png', debug: bool = SETTINGS['DEBUG']) duck.http.response.TemplateResponseΒΆ
Transforms a basic response like HttpServerErrorResponse into a nicer Duck response.
- Parameters:
response_class β The response class to be transformed.
title β The title of the response, If not provided, response.status_message is used (optional).
heading β The heading of the response. If not provided, response.status_message is used (optional).
body β The body of the response. If not provided, response.status_explanation is used (optional).
icon_link β The link to the icon (optional).
icon_type β The type of the icon (optional).
debug β Whether to render template in debug mode. Defaults to the one set in settings.py
- Returns:
The transformed response.
- Return type: