Files
server/article/views.py
T
ngfchl 777ca50328 update. 完成前端页面展示、列表和详情页
update. 调整融合主菜单与板块
update. 分离新闻模块
2026-04-01 14:17:03 +08:00

21 lines
599 B
Python

from django.http import HttpResponseForbidden
from django.shortcuts import render
from article.models import Article
from utils.permission import user_has_permission
from ninja import Router
# Create your views here.
# Create your views here.
router = Router(tags=['content'])
@router.get('/article', description="获取文章列表")
def article_details(request):
if not user_has_permission(request.user, 'article', 'view'):
return HttpResponseForbidden("无权访问")
articles = Article.objects.all()
return render(request, 'articles/list.html', {'articles': articles})