A template is a text file. It can generate any text-based format (HTML, XML, CSV, etc.).
A template contains variables, which get replaced with values when the template is evaluated, and tags, which control the logic of the template.
Template is used by view function to represent the data to user.
User sends request to view then view contact template after that view get information from the template and then view gives response to the users.
.png?h=55fedb3ea19bfb45307db4657eddd346)
.png?h=c1032cc26d2b5e397874e4c69d6f7239)
.png?h=7d614f0c3a09f7972edeb75030cc4329)
render( ) Function - It combines a given template with a given context dictionary and returns an HttpResponse object with that rendered text.
Syntax:-
render(request, template_name, context=dict_name, content_type = MIME_type, status=None, using=None)
Where,
request – The request object used to generate this response.
template_name – The full name of a template to use or sequence of template names. If a sequence is given, the first template that exists will be used.
context – A dictionary of values to add to the template context. By default, this is an empty dictionary. If a value in the dictionary is callable, the view will call it just before rendering the template.
content_type – The MIME type to use for the resulting document. Defaults to 'text/html'.
status – The status code for the response. Defaults to 200.
using – The NAME of a template engine to use for loading the template.
.png?h=d7602ed6475abbe603e48b87a92e188e)
.png?h=33a476f769c58ad53cc753b9cdeab7fb)
.png?h=e20ecc3d92e3c7972ea89d2aed750d1d)