init. 初始化项目,并初步完成前端模板样式

This commit is contained in:
2026-03-26 11:08:42 +08:00
commit af9d7a676f
116 changed files with 5266 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
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_list(request):
if not user_has_permission(request.user, 'article', 'view'):
return HttpResponseForbidden("无权访问")
articles = Article.objects.all()
return render(request, 'articles/list.html', {'articles': articles})