passing variable to django custom template tag
Im using django-profiles. In my profile_detail template I know that I will receive a profile variable.
I want to make a custom tag that gets the content per user via user id. Like this:
{% get_user_content book.review profile.user.id as review_list %}
However, when my pars开发者_StackOverflow中文版er runs It seems like profile.user.id was not transformed to an id number and throws an exception.
I can verify that my custom tag works by changing profile.user.id to say 1 for admin.
{% get_user_content book.review 1 as review_list %}
Has anyone deals with it before? What did you do?
Template tags never translate arguments. You need to do the lookup in the context yourself.
精彩评论