formation_django/exemple/mon_site/blog/views.py
2018-04-07 15:49:12 +02:00

14 lines
357 B
Python

from django.shortcuts import render
from django.http import HttpResponse
from .models import Article
def index(request):
articles = Article.objects.order_by('-date')
s = ("Bonjour et bienvenue"
" sur mon super site trop cool"
"\nMes articles :"
)
for a in articles:
s += a.title + "\n"
return HttpResponse(s)