What you are asking is how to use a variable as a key into a
dictionary, you cannot normally do this with Django template. You
can get around it by using a template tag or try this:
{% for date in date_list.items|dictsort:"0" %}
{{ date.1 }}
{% endfor %}
Here's an explanation of how the a
Mark Jarecki wrote:
Replaced the dictionary in the views.py with a list and all was fine.
Whoops, sorry; I saw a variable called "Date_List" and didn't notice it
wasn't a list. Glad you were able to make things work.
-Zak
--~--~-~--~~~---~--~~
You received th
Replaced the dictionary in the views.py with a list and all was fine.
Thanks
Mark
--~--~-~--~~~---~--~~
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@googlegro
Thanks Zak,
Problem is, when I try:
{% for date in Date_List %}
{{ date }}
{% endfor %}
I get the following rendered:
1
0
3
2
5
4
6
What I'm wanting to render is:
2007-01-17
2007-01-18
2007-01-19
2007-01-20
2007-01-21
2007-01-22
2007-01-23
Not sure where I'm going wrong.
On 17/01/20
Mark Jarecki wrote:
I imagined replacing it with something like:
{% for date in Date_List %}
{{ Date_List.NotSureWhatToPutHere }}
{% endfor %}
Much like Python loop syntax:
{% for date in Date_List %}
{{ date }}
{% endfor %}
-Zak
--~--~-~--~~~---~--~~
Y
5 matches
Mail list logo