I’ve written a custom template tag:
def mytag(para):
return something
In my template I am getting a value {{value}}. Now I am using {{value|mytag}} to apply the tag to the value, and it is throwing a syntax error.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To use template tags in Django, you wrap the name of the tag in
{%and%}, like this:If your tag takes a parameter, as yours seems to, you pass the parameter after the name of the tag:
The syntax you were trying to use —
{{ value|mytag }}is for template filters, not tags.