'Create a new saved search
Create a new saved search for the given project.
{method} {path}
"name": "Latest Release",
"query": "release:[latest]"'

def post(self, request, project):

    serializer = SavedSearchSerializer(data=request.DATA)
    if serializer.is_valid():
        result = serializer.object
        with transaction.atomic():
            try:
                search = SavedSearch.objects.create(project=project, name=result['name'], query=result['query'], is_default=result.get('isDefault', False), owner=(None if request.access.has_scope('project:write') else request.user))
                save_search_created.send(project=project, sender=self)
            except IntegrityError:
                return Response({'detail': 'Search    with    same    name    already    exists.'}, status=400)
            if search.is_default:
                if request.access.has_scope('project:write'):
                    SavedSearch.objects.filter(project=project).exclude(id=search.id).update(is_default=False)
                else:
                    return Response({'detail': "User    doesn't    have    permission    to    set    default    view"}, status=400)
            if result.get('isUserDefault'):
                SavedSearchUserDefault.objects.create_or_update(savedsearch=search, user=request.user, project=project)
        return Response(serialize(search, request.user), status=201)
    return Response(serializer.errors, status=400)
