Thanks for the quick reply on this. I got it working with your advice, but am still a bit confused with the end result.
On your advice I used Zip on the 2 lists, which resulted in a list of tuples like this: [[(u'image_url', u'image snippet'), (u'image_url_2', u'snippet_2'), (u'image_url_3', u'snippet_3')]] >From within m django template it took me a bit before I realized that I basically had to unpack this twice. The outer loop gave me access to list[0], and from there I could use the Django 1.0 syntax to iterate through the tuples (for x,y in tuple). Anyway, thanks again. Cheers, dylan On Dec 9, 11:59 pm, Alexander Kojevnikov <[email protected]> wrote: > In your handler, pass: > > zip(entity.images, entity.snippets) > > ...to your template. Let's say the template variable is called > "items". Then in the template you can do: > > {% for image, snippet in items %} > Do something with {{ image }} and {{ snippet }}. > {% endfor %) > > Above will work in Django 1.0. If you use the built-in Django 0.96, > use this instead: > > {% for item in items %} > Do something with {{ item.0 }} and {{ item.1 }}. > {% endfor %) > > On Dec 10, 5:38 pm, Dylan Lorimer <[email protected]> wrote: > > > Hi, > > > Perhaps this is more of a design issue than anything, but here's the > > dilemma I'm up against: > > > I have a model class that has 2 GAE StringList properties,'images' and > > 'snippets'. 'images' contains a list of URLs pointing to images, and > > snippets has corresponding image descriptions. > > > For clarity's sake, snippets[0] goes with images[0]. > > > I can't for the life of me figure out how to iterate through both > > images and snippets in a Django template to output the image URL + > > associated snippet. > > > Any ideas? I'd be up for a better way to store both image URLs + > > snippets if that made the most sense, but I don't see a better way. > > Ideally I could store a dictionary but the GAE doesn't support > > dictionaries as database types, right? > > > Your help is kindly appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
