ary like a list using these:
>>
>> items.keys(), template:
>>
>> for k in items.keys
>>
>>
>>
>> items.values(), template:
>>
>> for v in items.values
>>
>>
>>
>> items.items(), template:
oglegroups.com [mailto:django-users@
> googlegroups.com] *On Behalf Of *Andréas Kühne
> *Sent:* Wednesday, June 20, 2018 2:28 AM
> *To:* django-users@googlegroups.com
> *Subject:* Re: Help with context_processor
>
>
>
> Hi Mikkel,
>
>
>
> No - you can't loop o
[mailto:django-users@googlegroups.com] On
Behalf Of Andréas Kühne
Sent: Wednesday, June 20, 2018 2:28 AM
To: django-users@googlegroups.com
Subject: Re: Help with context_processor
Hi Mikkel,
No - you can't loop over a dictionary that way. However - You don't need to
resort to doing that eith
Hi Mikkel,
No - you can't loop over a dictionary that way. However - You don't need to
resort to doing that either. If you want to loop over something use a list.
Like this:
return {
'items': [
{'name': 'year', 'readable': 'Year', 'urlname': 'year_list' },
{'name': 'region', 'r
Thank you so much Andreas.
This is very helpful.
I wasn't able to figure that from the documentation (not sure who to blame,
though ;)
So I relied on various stackoverflow posts, which were quite confusing to
say the least.
Now, is there anyway I can loop over the items in the dictionary?
In th
First of all - that is not how a context processor works.
You are confusing template tags and context processors. A template tag is
one of the following:
https://docs.djangoproject.com/en/2.0/howto/custom-template-tags/
It must then be registered and then included in your template. So then you
sh
Hi.
Once again thanks for all your invaluable advice to me so far. Now, I'm
battling context_processors.
I really struggle to find a good example that can help me understand how to
use them.
They seem quite helpful to a lot of stuff I plan to do.
I think I got the configuration in settings.py a
7 matches
Mail list logo