Hi, I am suffering whereever i try to do something in django that is not common(in django, not in python in general)
For example, i don't know how to return an inclusion tag. This. obviously, won't work:
@register.inclusion_tag('template.tpl')
def myinclusiontag(parameter):
return {'var': parameter.attr1}
@register.inclusion_tag('template2.tpl')
def myinclusiontag2(parameter):
return {'var': parameter.attr2}
@register.simple_tag
def mysimpletag(paramter):
if parameter.attr: return myinclusiontag(parameter)
else: return myinclusiontag2(paramter)
mysimpletag return a dict(first returned by the inclusion tag), wich is a normal behaviour, but this is not my i want.
help pls