Re: loop over model ids ? possible ?
On Thu, 2012-05-24 at 23:19 -0700, doniyor wrote:
> 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
i is not the id.
for prod in Produkt.objects.all():
do something with prod
--
regards
Kenneth Gonsalves
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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