fix
parent
fed891f6a7
commit
8c3b630eb6
|
@ -1,14 +1,17 @@
|
|||
import django.template
|
||||
from django.template import Template
|
||||
from django.template.engine import Engine
|
||||
|
||||
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 = Template(text, using='DjangoTemplates')
|
||||
template = engine.from_string(text)
|
||||
return template.render(context)
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue