Render Multiple Template From A Single View In Django
I want to send context data to one html and want to render different html. After login user is redirected to this dashboard view. Here I want to render two html file, the context v
Solution 1:
You can't render two html file in single view. Please use the Django template language for the desired behaivour.
i.e) If your passing obj
to dashboard.html
and inside html files can also access obj.
dashboard.html
{{ obj }}
{% include'test1.html' %}
{% include'test2.html' %}
You can pass additional context to the template using keyword arguments:
{% include 'test1.html'with obj=obj additional_context='blah' %}
test1.html
{{ obj }}
Post a Comment for "Render Multiple Template From A Single View In Django"