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.id)+"'>"+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