user493550
user493550

Reputation: 217

Django custom tags

I m builting a custom tag where i have to pass multiple params. i can do as args with , seperated list but i m facing problem while passing object in that list.

def mytag(id,args):

and i m calling it and passing args like this in html

 {% for image in images %}
  {{ image.pk|mytag:"100,100"}}
 {% endfor %}

in above scenario i m passing pk and 100 , 100 and it works fine. but i have to pass another thing which is object. {{ image.pk|mytag:"100,100,{{image.name}}"}} but this is not working tried different syntax but no success.

Upvotes: 0

Views: 81

Answers (1)

Aidas Bendoraitis
Aidas Bendoraitis

Reputation: 4003

What you are showing us here is not a tag, but a filter.

If you still want to use the filter, you can apply it to the image object instead, so you don't need to pass a value of the title:

{{ image|myfilter:"100,100" }}

Upvotes: 3

Related Questions