Issue
How to adjust the project to improve the performance result:
in myworld/members/view.py:
def testing(request):
template = loader.get_template('template.html')
context = {
'heading': 'Hello <i>my</i> World!',
}
print(context)
return HttpResponse(template.render(context, request))
in myworld/members/templates/template.html :
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Learning_21_1_1</title>
</head>
<body>
{% autoescape off %}
<h1>{{ heading }}</h1>
{% endautoescape %}
<p>Check out views.py to see what the heading variable looks like.</p>
</body>
</html>
result : enter image description here
main result : enter image description here
please help me
Solution
===== put like this in (views.py) ========
context = {'heading': 'Hello <i>my</i> World!'}
==== Html code ======
{% autoescape off %}
<h1>{{heading}}</h1>
{% endautoescape %}
==== Html result ======
for more information about autoescape
https://www.djangotemplatetagsandfilters.com/tags/autoescape/
Answered By - Mahammadhusain kadiwala
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.