14 lines
438 B
Python
14 lines
438 B
Python
|
|
from django.shortcuts import get_object_or_404, render
|
||
|
|
|
||
|
|
from .models import Article
|
||
|
|
|
||
|
|
|
||
|
|
def article_list(request):
|
||
|
|
articles = Article.objects.filter(is_published=True)
|
||
|
|
return render(request, "landing/article_list.html", {"articles": articles})
|
||
|
|
|
||
|
|
|
||
|
|
def article_detail(request, slug):
|
||
|
|
article = get_object_or_404(Article, slug=slug, is_published=True)
|
||
|
|
return render(request, "landing/article_detail.html", {"article": article})
|