Hi,

In a template context, I have:
- user_answers, that hold previously given answers by the user in a
format like: {1:'yes', 2:'yes', 3:'no'}, where 1,2 & 3 are the
question ids.
- question, that is a Question() instance

When displaying a list of questions, I would like to check if the
question is in the list of already answered questions and display the
given answer.

I thought this should let me access the answer given for that
particular question instance:

{% with question.id as question_id %}
    {{ user_answers.question_id }}
{% endwith %}

but it didn't.

I tested the following:
{{ user_answers.1 }} gives 'yes' as expected

When {{ question.id }} is "1", within the "with" block,
{{ question_id }} gives "1"

but {{ user_answers.question_id }} does not.


Thanks for any help,
oMat


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to