Saturday, May 26, 2012

how to do this?

hey guys, i need again a small help. i want to create so many htmls as the number of objects of my model in db. i am trying, but it is stopping after the first creation, because i am doing render_to_response and after the first render_to_response it is not going to the second loop, because i "return",  

how is it possible? 

this is my code.
 
for p in Produkt.objects.all():
            col = p.arg1
            row = p.arg2
            t = Template('<p> test </p>')
            c = Context({'col': col, 'row':row})
            html = t.render(c)
            return render_to_response('book.html', {'html': html}, context_instance=RequestContext(request))
        return render_to_response('book.html', {'titel': titel}, context_instance=RequestContext(request))

thanks many 

--
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/-/yFqONaxfSzQJ.
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