Files
lab6/articles/views.py
2025-10-06 21:32:59 +03:00

14 lines
412 B
Python

from .models import Article
from django.shortcuts import render
from django.http import Http404
def archive(request):
return render(request, 'archive.html', {"posts": Article.objects.all()})
def get_article(request, article_id):
try:
post = Article.objects.get(id=article_id)
return render(request, 'article.html', {"post": post})
except Article.DoesNotExist:
raise Http404