code: def new_project():
      
      form = NewProjectForm()
      if not form.validate_on_submit():
          return jsonify(errors=form.errors), 400
  
      data = form.data
      data['slug'] = slugify(data['name'])
      data['owner_id'] = get_current_user_id()
  
      id = add_instance('project', **data)
  
      if not id:
          return jsonify(errors={'name': ['duplicated slug.']}), 400
  
      project = get_data_or_404('project', id)
  
      return jsonify(**project)
docs: New Project.