def delete(self, nid):
     m = NoticeModel.find_one_by(id=nid)
     if m:
         NoticeModel.delete(m.id)
         return dict(code=200, msg='success', data=None)
     else:
         return dict(code=404, msg='not found', data=None)
    def put(self, nid):
        notice = NoticeModel.find_one_by(id=nid)
        if notice:
            form = NoticeForm(meta=dict(csrf=False))

            m = notice.update(user_id=current_user.id, **form.form)
            return dict(code=200, msg='success', data=m.asdict())
        else:
            return dict(code=404, msg='not found', data=None)