def get_pretty_smartpage_for_email(slug, context=None,
surrounding_template='email/pretty.html'):
"""
Renders a smartpage using the 'pretty' email template
returns the rendered content, with any passed-in context rendered in
"""
try:
s = SmartPage.objects.get(slug=slug)
except SmartPage.DoesNotExist:
s = SmartPage(content='Error: Missing template: %s' % slug,
name='Missing template')
if context:
# Render any passed-in context into the smartpage
sptemplate = loader.get_template_from_string(s.content)
spcontent = sptemplate.render(context)
else:
spcontent = s.content
if slug == 'email-policy-summary' or 'fleet-email-policy-summary':
spcontent = '
http://lime.paston.co.uk/media/images/Keyfacts_logo_.jpg ' + spcontent
context = Context({
'content' : spcontent,
'title' : s.name,
})
t = loader.get_template(surrounding_template)
content = t.render(context)
--
View this message in context: http://old.nabble.com/escaping-%28where-is-the-exit%29-tp31531487p31531945.html
Sent from the django-users mailing list archive at Nabble.com.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment