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: