Re: Help with context_processor

2018-06-20 Thread Mikkel Kromann
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:

Re: Help with context_processor

2018-06-20 Thread Andréas Kühne
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

RE: Help with context_processor

2018-06-20 Thread Matthew Pava
[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

Re: Help with context_processor

2018-06-20 Thread Andréas Kühne
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

Re: Help with context_processor

2018-06-19 Thread Mikkel Kromann
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

Re: Help with context_processor

2018-06-18 Thread Andréas Kühne
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