Esempio 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
Esempio 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
Esempio 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
Esempio 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