Django: how to pass form variable to simple tag in template

Posted by Remigijus on Stack Overflow See other posts from Stack Overflow or by Remigijus
Published on 2010-06-16T20:42:33Z Indexed on 2010/06/17 7:23 UTC
Read the original article Hit count: 170

Filed under:
|
|

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!

© Stack Overflow or respective owner

Related posts about django

Related posts about problem