Which is the correct syntax to write comments in Django views?

26. Which is the correct syntax to write comments in Django views?

  1. # ..
  2. /* … *
  3. {{# ... #}}
  4. {# ... #}

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())

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.