from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse

from .models import Article

def index(request):
    articles = Article.objects.order_by('-date')
    return render(request, 'blog/list_articles.html', {'articles':articles})

def view_article(request, pk):
    article = get_object_or_404(Article, pk=pk)
    return render(request, 'blog/view_article.html', {'article':article})
