Answer the question
In order to leave comments, you need to log in
How to get value from dictionary in Django template based on data from queryset?
Greetings!
Apparently, I'm wildly stupid, but something doesn't go skiing.
There is a queryset, let's call it keywords, it contains the actual words (strings), there is a word_freq dictionary, it looks like this:
{
'foo': 3,
'bar': 5,
...
}
{% for keyword in keywords %}
{% if keyword.keyword in word_freq %}
{{ keyword.keyword }}: {{ word_freq.keyword.keyword }}
{% endif %}
{% endfor %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question