Re: How to get an dictionary item in template

2010-12-26 Thread BigBlogMaker
Each product can have multiple images. images are divided by type. it facilitates the withdrawal of the desired image in the right place. On 27 дек, 01:35, Mikhail Korobov wrote: > production = Production.objects.all() > for product in production: >     try: >        

Re: How to get an dictionary item in template

2010-12-26 Thread Mikhail Korobov
production = Production.objects.all() for product in production: try: product.image = product.image_set.get (somefield = somevalue) except Image.DoesNotExist: pass {% for product in production %} {{ product.title }} {% endfor %} or even better implement the

How to get an dictionary item in template

2010-12-26 Thread BigBlogMaker
I'm sorry for my english, but on other groups nobody does not answers. In view defined variables: production = Production.objects.all () images = {} for product in production: try: image = product.image_set.get (somefield = somevalue) images [product.id] = image except: