Thursday, May 24, 2012

loop over model ids ? possible ?

hey guys, 
i need to loop over the number of ids of objects in my db table and create accordingly the same number of html fields. how can i do it.. my effort is this: 
 numberOfIds = Produkt.objects.count()
        i = 1;
        for i in range(0,numberOfIds):
            p = Produkt.objects.get(id=i)
            #lookup in db and create html input field depending on the #of ids. 
            i=i+1

but it says: Produkt matching query does not exist. i know, obviously it is not right, but how is it possible? 

thanks for help 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/E1WSc-qMWyUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate