Re: Django template : For Loop

2010-09-06 Thread Tim Chase
but is this correct way to get values from two tables and use in templates? Me actually want to combine to tables and use there values in template Is the above post code is correct way to do this? Combine the in the *view* with the zip() built-in, and use Steve's suggestion to split the

Re: Django template : For Loop

2010-09-06 Thread Jagdeep Singh Malhi
> but is this correct way to get values from two tables and use in > templates? Me actually want to combine to tables and use there values in template Is the above post code is correct way to do this? Thanks -- You received this message because you are subscribed to the Google Groups

Re: Django template : For Loop

2010-09-05 Thread Jagdeep Singh Malhi
> > I tried this, its not working. > > Sorry, but "not working" does not constitute useful information. > > My car isn't working. Can you fix it? ;-) model.py from django.db import models from django.forms import ModelForm class Input(models.Model): input1 = models.FloatField() input2

Re: Django template : For Loop

2010-09-05 Thread Steve Holden
On 9/5/2010 12:29 PM, Jagdeep Singh Malhi wrote: > >> If these objects are lists, say list1 and list2, in your view just >> create a single object made up of pairs of elements from the original lists: >> >>values = zip(list1, list2) >> >> Then you can pass that item to your template and

Re: Django template : For Loop

2010-09-05 Thread Justin Myers
What error message is it giving you? I'd assume it's a problem with the objects you're passing it, since zip is a built-in Python function: http://docs.python.org/library/functions.html#zip On Sep 5, 11:29 am, Jagdeep Singh Malhi wrote: > > If these objects are lists,

Re: Django template : For Loop

2010-09-05 Thread Jagdeep Singh Malhi
> If these objects are lists, say list1 and list2, in your view just > create a single object made up of pairs of elements from the original lists: > >    values = zip(list1, list2) > > Then you can pass that item to your template and iterate over it. I tried this, its not working. -- You

Re: Django template : For Loop

2010-09-05 Thread Steve Holden
On 9/5/2010 7:54 AM, Jagdeep Singh Malhi wrote: >> I have question about "for loop" used in Templates the correct >> Syntax of using For Loop in template is : {% for X in VALUE %} >> >> but I want to use For loop with two value Is it possible to use two >> value in one loop? For example : {% for

Django template : For Loop

2010-09-05 Thread Jagdeep Singh Malhi
I have question about "for loop" used in Templates the correct Syntax of using For Loop in template is : {% for X in VALUE %} but I want to use For loop with two value Is it possible to use two value in one loop? For example : {% for X, Y in VALUE1, VALUE2 %} Or {% for X in VALUE1 && Y in

Re: accessing dictionary elements in opening tag of django template for loop

2008-05-16 Thread John
Thanks, John. Your second suggestion (that I find a way to modify the Document class) put me on the right track. I eventually found this article: http://blog.arbingersys.com/2008/04/google-app-engine-better-many-to-many.html which worked for my problem. On May 14, 7:17 pm, "John Lenton"

Re: accessing dictionary elements in opening tag of django template for loop

2008-05-14 Thread John Lenton
On Wed, May 14, 2008 at 6:33 PM, John <[EMAIL PROTECTED]> wrote: > > I'm having trouble accessing dictionary elements within a nested for > loop. here are some code snippets: > > [...] > > # so far so good, but then I try to iterate over the documents and > their associated tags in a template >

Re: accessing dictionary elements in opening tag of django template for loop

2008-05-14 Thread John
Thanks for the response, Norman! Unfortunately, the Google App Engine version of Django doesn't support the 'with' tag (which would otherwise solve my problem). Also, I don't think I can pass in a context var that already has the list I want, because I need a list *per* document. Any

Re: accessing dictionary elements in opening tag of django template for loop

2008-05-14 Thread Norman Harman
Sorry, I don't know the exact answer but I can point you in right direction. templates always use dot notation for dictionary access tag_dict.document.uid But I don't think that will work inside a "for" tag and also won't work cause you want the document.uid to be key not "document". The

accessing dictionary elements in opening tag of django template for loop

2008-05-14 Thread John
Hello Django Users, I'm having trouble accessing dictionary elements within a nested for loop. here are some code snippets: # here is the python code that sets up the page class DocumentPage(webapp.RequestHandler): def get(self): # get a list of documents from google app engine datastore