Home »
Python »
Django MCQs
Which is the correct syntax to write comments in Django views?
26. Which is the correct syntax to write comments in Django views?
- # ..
- /* … *
- {{# ... #}}
- {# ... #}
Answer: A) # ...
Explanation:
Django views are Python functions i.e., they are written in Python. Thus, the Python comment character (#) can be used to write comments in Django views. Consider the below example –
def testing_function(request):
templateObj = loader.get_template('template_student.html')
#context = {
# 'var1': 'John',
#}
return HttpResponse(templateObj.render())