comment and uncomments in django html template

52 views
Skip to first unread message

Sindhujit Ganguly

unread,
Jun 19, 2015, 4:44:34 PM6/19/15
to django...@googlegroups.com
Hi,
  Does anyone know how to do multiple line comments in django html templates?

Thanks

Karen Tracey

unread,
Jun 19, 2015, 4:46:40 PM6/19/15
to django...@googlegroups.com
On Fri, Jun 19, 2015 at 12:42 PM, Sindhujit Ganguly <siga...@colorado.edu> wrote:

  Does anyone know how to do multiple line comments in django html templates?

Sindhujit Ganguly

unread,
Jun 19, 2015, 4:48:41 PM6/19/15
to django...@googlegroups.com
This does not work for javascript defined inside html templates.. This is for html structures.. I needed for multiple line comments in js scripts.

Bill Freeman

unread,
Jun 19, 2015, 4:54:38 PM6/19/15
to django-users
If your JavaScript comes from a django template, yes, the comment tag will work.  If, instead, you want the lines delivered to the browser, but commented out as far as JavaScript is concerned, use /* to start the comment and */ to end it -- multiple lines are allowed.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3d5ed791-e3c1-4ee9-936d-e649f905839c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Daniel Roseman

unread,
Jun 20, 2015, 11:42:03 AM6/20/15
to django...@googlegroups.com
On Friday, 19 June 2015 17:48:41 UTC+1, Sindhujit Ganguly wrote:
This does not work for javascript defined inside html templates.. This is for html structures.. I needed for multiple line comments in js scripts.

That is totally false. Anything within a Django comment tag will not be rendered in the output, whether it's HTML or JS.

But if you need comments inside JS scripts, why don't you use JS comment syntax?
--
DR.
Reply all
Reply to author
Forward
0 new messages