I have my own template tag that shows a calendar. I want to fill in certain elements in a calendar based on a dynamic value.
Here is the tag:
@register.inclusion_tag("website/_calendar.html") def calendar_table(post): post=int(post) imp=IMP.objects.filter(post__pk=post) if imp: ...do stuff
In my template, it works fine when I pass a hard-coded value like
{% load inclusion_tags %} {% calendar_table "6" %}
However, when I try something like {% calendar_table "{{post.id}}"%}, it throws a ValueError error for an int () attempt. How can I get around this?
source share