dj111
eric 2018-07-24 12:17:58 -04:00
parent 8c3b630eb6
commit bc3e5e4ef7
1 changed files with 2 additions and 5 deletions

View File

@ -1,17 +1,14 @@
import django.template
from django.template.engine import Engine
from django.template import Template
register = django.template.Library()
engine = Engine.get_default()
@register.simple_tag(takes_context=True)
def render_with_landing(context, text):
if not context.has_key('landing_object') and context.has_key('runinfo'):
landing = context['runinfo'].landing
context['landing_object'] = landing.content_object if landing else ''
if text:
template = engine.from_string(text)
template = Template(text)
return template.render(context)
else: