Example #1
0
def create():
    #Auth check
    auth.authenticated_or_401()

    if request.method == "POST":
        #Chequea permiso
        User.db = get_db()
        if (not User.has_permission(session['id'],'estudiante_new')):
            abort(401)
        else:
            # if forms.ValidateStudent(request.form).validate():
            post_data = request.get_json()
            Responsable.db = get_db()
            responsable_id = Responsable.create(post_data)
            Student.db = get_db()
            Student.create(post_data, responsable_id)
            response_object = {'status': 'success', 'message': 'Se agregó el nuevo estudiante'}
            # else:
            #     response_object = {'status': 'warning', 'message': 'Verifica los campos obligatorios y no ingreses valores no permitidos'}
            return jsonify(response_object)
Example #2
0
 def save(self):
     self.responsables_saved = Form.save(self.responsables_forms)
     student = Student.create(self.values)
     return student