777ca50328
update. 调整融合主菜单与板块 update. 分离新闻模块
21 lines
599 B
Python
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})
|