Django: how to pass form variable to simple tag in template
- by Remigijus
Hello. I am trying to do some custom things in Django comments form. I have simple tag named "get_flatpage_by_id" that returns flatpage model data as array. This is working I expected:
{% get_flatpage_by_id 14 as page %}
It's returning flatpage that ID is 14. But this is not working, if I try to pass {{ form.object_pk.data }} (that returns 14). This is how it should look like:
{% get_flatpage_by_id form.object_pk.data as page %}
Simple tag receives value "form.object_pk.data" (string), not 14. I don't know how to tell Django that "form.object_pk.data" is variable, not a string!