Django - Template not complete rendered
I have a website on a django framework, and in a set of pages I use the Paginator. With paginator, my last page sometimes does not render completely.
You can see the problem here.
Code:
view rank - http://code.google.com/p/myps3t/source/browse/views.py template - http://code.google.com/p/myps3t/source/browse/www/Rank.html
Just refresh a couple of times and look at the end of the table.
Sometimes it appears, sometimes not.
Can I see the template render output to understand how the page sometimes is full rendered, so开发者_Python百科metimes not?
You asked if you can see the template render output. You can.
django.shortcuts.render_to_response is a very short function:
httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}
return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
You can make your own render_to_response function that shows the intermediate value. Use something like:
from django.template import loader
def my_render_to_response(*args, **kwargs): httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)} x = loader.render_to_string(*args, **kwargs) print "RENDERED AS",x return HttpResponse(x , **httpresponse_kwargs)
If you use the django development web server, the print statement will come out on standard out. If you are using some other web server, you may need to write the value of x to a file.
In this way, you can see whether your entire template is rendered as you expect.
精彩评论