'Create a New Project
Create a new project bound to a team.
:pparam string organization_slug: the slug of the organization the
team belongs to.
:pparam string team_slug: the slug of the team to create a new project
for.
:param string name: the name for the new project.
:param string slug: optionally a slug for the new project.  If it\'s
not provided a slug is generated from the name.
:auth: required'

@attach_scenarios([create_project_scenario])
def post(self, request, team):

    serializer = ProjectSerializer(data=request.DATA)
    if serializer.is_valid():
        result = serializer.object
        try:
            with transaction.atomic():
                project = Project.objects.create(name=result['name'], slug=result.get('slug'), organization=team.organization, team=team, platform=result.get('platform'))
        except IntegrityError:
            return Response({'detail': 'A    project    with    this    slug    already    exists.'}, status=409)
        self.create_audit_entry(request=request, organization=team.organization, target_object=project.id, event=AuditLogEntryEvent.PROJECT_ADD, data=project.get_audit_log_data())
        project_created.send(project=project, user=request.user, sender=self)
        return Response(serialize(project, request.user), status=201)
    return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
