pepper5319
pepper5319

Reputation: 667

Django - Tag inside a Template tag

So I'm using the django-jcrop plugin to crop an image. Inside my HTML file I have this line:

<img src="{% cropped_thumbnail order 'cropping' max_size='{{ ratio }}' %}">

When this is passed, I get the following error:

TemplateSyntaxError: max_size must match INTxINT

{{ ratio }} is passed correctly outside of the tag, and gives the correct intended value, 400x400. When I remove the single quotes from the max_size='{{ ratio }}' I then get the following error:

TemplateSyntaxError: Could not parse the remainder: '{{' from '{{'

So I am pretty sure ratio is not parsing correctly within the tag. Any ideas why?

Upvotes: 7

Views: 821

Answers (1)

Nazkter
Nazkter

Reputation: 1110

inside a template tag you don't need to use the "{{}}", you can try the next code:

<img src="{% cropped_thumbnail order 'cropping' max_size=ratio %}">

Upvotes: 2

Related Questions