Reputation: 113
While working on a project on django , I came to a situation where I have to join four strings and also have to save the joined string in another variable. So, I made two custom template tag to do so. 1) for saving one data to another
@register.simple_tag
def save(value):
return value
2)to join the strings
@register.simple_tag
def link(a,b,c,d):
data=str(a)+","+str(b)+str(c)+","+str(d)
return data
but when I am calling them from template like-
{% save link 14 12 2 3 as data %}
an error occurred saying--
'save' received too many positional arguments
that means they are overlapping each other. Now how to resolve this issue?
Upvotes: 0
Views: 295
Reputation: 1394
Instead of using one template tag, you can use two tag line by line...
{% link 14 12 2 3 as data %}
{% save data as value %}
Upvotes: 1