mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 08:34:55 +00:00
add message for blank search
This commit is contained in:
@ -111,7 +111,8 @@ ERROR_CODE = {
|
|||||||
"2080": "Can not add App version",
|
"2080": "Can not add App version",
|
||||||
"2081": "A junior can only be associated with a maximum of 3 guardian",
|
"2081": "A junior can only be associated with a maximum of 3 guardian",
|
||||||
# guardian code not exist
|
# guardian code not exist
|
||||||
"2082": "Guardian code does not exist"
|
"2082": "Guardian code does not exist",
|
||||||
|
"2083": "Search should not be blank"
|
||||||
|
|
||||||
}
|
}
|
||||||
"""Success message code"""
|
"""Success message code"""
|
||||||
|
|||||||
@ -223,6 +223,8 @@ class AddJuniorAPIView(viewsets.ModelViewSet):
|
|||||||
junior.guardian_code.append(guardian.guardian_code)
|
junior.guardian_code.append(guardian.guardian_code)
|
||||||
else:
|
else:
|
||||||
return "Max"
|
return "Max"
|
||||||
|
if junior.guardian_code_status and ('-' in junior.guardian_code_status):
|
||||||
|
junior.guardian_code_status.remove('-')
|
||||||
if not junior.guardian_code_status:
|
if not junior.guardian_code_status:
|
||||||
junior.guardian_code_status = [str(NUMBER['two'])]
|
junior.guardian_code_status = [str(NUMBER['two'])]
|
||||||
else:
|
else:
|
||||||
@ -355,6 +357,8 @@ class JuniorTaskListAPIView(viewsets.ModelViewSet):
|
|||||||
try:
|
try:
|
||||||
status_value = self.request.GET.get('status')
|
status_value = self.request.GET.get('status')
|
||||||
search = self.request.GET.get('search')
|
search = self.request.GET.get('search')
|
||||||
|
if search.strip() == '':
|
||||||
|
return custom_error_response(ERROR_CODE['2083'], response_status=status.HTTP_400_BAD_REQUEST)
|
||||||
if search and str(status_value) == '0':
|
if search and str(status_value) == '0':
|
||||||
# search with title and for all task list
|
# search with title and for all task list
|
||||||
queryset = JuniorTask.objects.filter(junior__auth=request.user,
|
queryset = JuniorTask.objects.filter(junior__auth=request.user,
|
||||||
|
|||||||
Reference in New Issue
Block a user