Beispiel #1
0
 def create_mentor(payload):
     try:
         data = request.get_json()
         name = data.get('name', '')
         skills = data.get('skills', '')
         is_mentor = data.get('is_mentor')
         participant = Participant(name=name,
                                   skills=skills,
                                   is_mentor=is_mentor)
         participant.insert()
         participants = Participant.query.all()
         formatted_participants = pagenate(request, participants)
         return jsonify({
             'success': True,
             'created': participant.id,
             'participants': formatted_participants,
             'total_participants': len(participants)
         }), 200
     except BaseException:
         abort(422)