Any tool to validate django templates?

743 views
Skip to first unread message

Marcin Tustin

unread,
Apr 15, 2012, 12:42:14 PM4/15/12
to django...@googlegroups.com
Hi all,

I've got a template that isn't parsing, but the error is the nondescript: TemplateSyntaxError: Could not parse the remainder: '"{%' from '"{%'

Is there a tool that can help locate the source of the error?

Marcin

--
Marcin Tustin
Tel: 07773 787 105

Matt Schinckel

unread,
Apr 16, 2012, 3:15:39 AM4/16/12
to django...@googlegroups.com
Generally, I just use syntax highlighting in my text editor: that usually helps me find errors.

TextMate has a nice HTML (Django Template) mode.

Matt.

william ratcliff

unread,
Apr 16, 2012, 8:45:17 AM4/16/12
to django...@googlegroups.com

Wing IDE also highlights templates.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/IOteWda5w0UJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

John Yeukhon Wong

unread,
Apr 16, 2012, 11:12:37 AM4/16/12
to django...@googlegroups.com
Would this help?
http://stackoverflow.com/questions/3086637/how-should-i-validate-html-in-django-templates-during-the-development-process

I quite like the not-accepted-as-answer. Just go through your urls. Essentially, you have two types of possible template errors:

1. human errors (missing a close tag / mispell)
2. logic error

For logic error, you are dealing with mostly logic tags  such as url tags or custom tags rendering problem. For example, does your {% url my_view id username %} actually works? are the variables passing to / from view are good for these tags? THis kind of error is not possible checked with going through all urls because u can't test possibility like that. THat has to be handled by unit test and integration (system) test.


Good luck.

Mario Gudelj

unread,
Apr 16, 2012, 11:15:01 AM4/16/12
to django...@googlegroups.com
PyCharm does a very good job here when it comes to highlighting and error detection in templates. Try it out.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ml-zdg0y4WEJ.

Marcin Tustin

unread,
Apr 16, 2012, 11:17:51 AM4/16/12
to django...@googlegroups.com
Thanks. Neither of those would help with my problem, which is that django itself was refusing to parse my template.

My solution was to simply comment out regions, and re-instate them until the error was once again detected.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ml-zdg0y4WEJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Reply all
Reply to author
Forward
0 new messages