Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from django.http import HttpResponse
from models import Post
def posts(request):
posts = Post.objects.all()
texto = "<h1>Lista de posts:</h1>"
texto += "<ul>"
for post in posts:
item = "<li><a href='/blog/post/"+str("'>"+post.title+"</a></li>"
texto += item
texto += "</ul>"
return HttpResponse(texto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.