[Answer]-Django render_to_response() is returning empty response

1👍

This line:

more_posts = Posts.objects.all()[loaded_post:5]

won’t work if loaded_post is greater than 5, since slicing a list [6:5] will return []. You presumably mean:

more_posts = Posts.objects.all()[loaded_post:loaded_post+5]

Leave a comment