formation_django/exemple/mon_site/blog/views.py

15 lines
357 B
Python
Raw Normal View History

2018-04-07 13:49:12 +00:00
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)