Задать вопрос

Тел: +7 965 3737 888

478

Просмотров

0

Ответов

Retrieve human-readable value from choices tuple or value from dict

<p>Will help you retrieve the value from a dictionary with a supplied key, or the human-readable value from a choices tuple. Works as follows:</p>
<p>To retrieve the value of a dict:
    {{ crime_rates_dict|getval:"Chicago" }} &lt;-- will return value of crime_rates_dict["Chicago"]</p>
To retrieve the human-readable value from a choices tuple:
`{{ country.COUNTRIES|getval:"US" }}` &lt;-- will return "United States" in `COUNTRIES = (("US", "United States"),)`

Вопрос полезен? Да0/Нет0
file_3107.py(1.1Кб)
None