示例#1
0
 def post(self):
     form = MilestoneCreateForm()
     if not form.validate_on_submit():
         return form.errors, 422
     milestone = Milestone(form.name.data, form.description.data, form.due_date.data, form.status.data)
     db.session.add(milestone)
     db.session.commit()
     return MilestoneSerializer(milestone).data, 201
示例#2
0
 def post(self):
     form = MilestoneCreateForm()
     if not form.validate_on_submit():
         return form.errors, 422
     milestone = Milestone(form.name.data, form.description.data,
                           form.due_date.data, form.status.data)
     db.session.add(milestone)
     db.session.commit()
     return MilestoneSerializer(milestone).data, 201
示例#3
0
 def put(self, id):
     form = MilestoneCreateForm()
     if not form.validate_on_submit():
         return form.errors, 422
     milestone = Milestone.query.filter_by(id=id).first()
     milestone.name = form.name.data
     milestone.description = form.description.data
     milestone.due_date = form.due_date.data
     milestone.stats = form.status.data
     db.session.commit()
     return MilestoneSerializer(milestone).data, 201
示例#4
0
 def put(self, id):
     form = MilestoneCreateForm()
     if not form.validate_on_submit():
         return form.errors, 422
     milestone = Milestone.query.filter_by(id=id).first()
     milestone.name = form.name.data
     milestone.description = form.description.data
     milestone.due_date = form.due_date.data
     milestone.stats = form.status.data
     db.session.commit()
     return MilestoneSerializer(milestone).data, 201