-1

I have this situation in my views.py

d = {'05:45':3,'06:30':6 (...) }
T = ['05:45','06:30' (...)]

I would like to get d[T[i]] in my HTML site

I tried to call this with dot, but it doesn't work. I will be thankful for help/hint.

rdas
  • 20,604
  • 6
  • 33
  • 46
wiktorous
  • 1
  • 1

1 Answers1

0

Thing you are trying to do is to get element from dictionary using variable. Am I right ? In django template engine it's a little bit tricky, but possible. Use some template tag from this question to acomplish this

Performing a getattr() style lookup in a django template

martinez
  • 63
  • 6
  • meh I read about this method, but this is so complicated for me.(I just begin my adventure with Django) – wiktorous Mar 08 '20 at 21:30