I'm writing a custom template tag 'firstnotnone', similar to the 'firstof' template tag of Django. How to use variable length arguments? The code below results in TemplateSyntaxError, firstnotnone takes 1 arguments.
Template:
{% load library %}
{% firstnotnone 'a' 'b' 'c' %}
Custom template tag library:
@register.simple_tag
def firstnotnone(*args):
print args
for arg in args:
if arg is not None:
return arg