mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-01-16 01:13:47 +00:00
support admin filter problems by problemID or problemDisplayID
This commit is contained in:
parent
5d07e455a4
commit
24a5b5a1bc
@ -8,6 +8,7 @@ from wsgiref.util import FileWrapper
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
from django.http import StreamingHttpResponse, FileResponse
|
||||
|
||||
from account.decorators import problem_permission_required, ensure_created_by
|
||||
@ -243,11 +244,11 @@ class ProblemAPI(ProblemBase):
|
||||
else:
|
||||
problems = problems.filter(rule_type=rule_type)
|
||||
|
||||
keyword = request.GET.get("keyword", "").strip()
|
||||
if keyword:
|
||||
problems = problems.filter(Q(title__icontains=keyword) | Q(_id__icontains=keyword))
|
||||
if not user.can_mgmt_all_problem():
|
||||
problems = problems.filter(created_by=user)
|
||||
keyword = request.GET.get("keyword")
|
||||
if keyword:
|
||||
problems = problems.filter(title__contains=keyword)
|
||||
return self.success(self.paginate_data(request, problems, ProblemAdminSerializer))
|
||||
|
||||
@problem_permission_required
|
||||
|
Loading…
x
Reference in New Issue
Block a user