Exemplo n.º 1
0
 def post(self):
     form = EffortCreateForm()
     if not form.validate_on_submit():
         return form.errors, 422
     effort = Effort(form.name.data, form.description.data)
     db.session.add(effort)
     db.session.commit()
     return EffortSerializer(effort).data, 201
Exemplo n.º 2
0
 def post(self):
     form = EffortCreateForm()
     if not form.validate_on_submit():
         return form.errors, 422
     effort = Effort(form.name.data, form.description.data)
     db.session.add(effort)
     db.session.commit()
     return EffortSerializer(effort).data, 201
Exemplo n.º 3
0
 def put(self, id):
     form = EffortCreateForm()
     if not form.validate_on_submit():
         return form.errors, 422
     effort = Effort.query.filter_by(id=id).first()
     effort.name = form.name.data
     effort.description = form.description.data
     db.session.commit()
     return EffortSerializer(effort).data, 201
Exemplo n.º 4
0
 def put(self, id):
     form = EffortCreateForm()
     if not form.validate_on_submit():
         return form.errors, 422
     effort = Effort.query.filter_by(id=id).first()
     effort.name = form.name.data
     effort.description = form.description.data
     db.session.commit()
     return EffortSerializer(effort).data, 201