I'm writing an application which is kind of event handling app, and the important functionality is sending emails. User can create his own email template, and when an event occurs the email is built using this template and sent. An event is nothing but a python dictionary with some values. As you may guess, I want to give the user a possibility to create an e-mail template which would use the variables from this dictionary (context).
In fact, I would like to do something as simple as this: #Create email body email_body = render_to_string(emailtemplate.emailbody, event.context) # Then send email... So when the user defines the email body template he could make it like "Hey {{receipent_name}}, event {{eventid}} has occured for device {{device_name}}". You get the idea: my application not only uses django template language internally to output html, but I must also offer a template language as a functionality for the users. I don't want to reinvent the wheel and write my own template language for handling all the variable placeholders, filters etc. But if I use django template engine to do this, the following issues arise: 1) I don't want django to process some of the tags. For example if somebody creates email template that contains {% url something %} - I don't want this to work. I want this tag to be disabled (and some others too) Is it possible? 2) I don't want filters and missing variables {{value}} to fail silently. When a variable is missing in context while rendering the email content - this is an error that I wish to handle (tell the user that his template is broken). Is this possible? Did anyone use a django template language in that fashion in a web application that, itself is written in django? Does it make sense? Is it safe? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.