管理员添加公有达人
This commit is contained in:
parent
dcab490420
commit
5f09ef3705
@ -2152,11 +2152,20 @@ def get_public_creators(request):
|
|||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@require_http_methods(["POST"])
|
@require_http_methods(["POST"])
|
||||||
def add_to_public_pool(request):
|
def add_to_public_pool(request):
|
||||||
"""将达人添加到公有达人库"""
|
"""将达人添加到公有达人库(仅管理员可操作)"""
|
||||||
try:
|
try:
|
||||||
from .models import PublicCreatorPool, CreatorProfile
|
from .models import PublicCreatorPool, CreatorProfile
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
# 检查当前用户是否有管理员权限
|
||||||
|
current_user = request.user
|
||||||
|
if not current_user.is_staff and not current_user.is_superuser:
|
||||||
|
return JsonResponse({
|
||||||
|
'code': 403,
|
||||||
|
'message': '权限不足,只有管理员可以添加/更新公有库达人',
|
||||||
|
'data': None
|
||||||
|
}, json_dumps_params={'ensure_ascii': False})
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
|
|
||||||
# 获取必要参数
|
# 获取必要参数
|
||||||
|
Loading…
Reference in New Issue
Block a user