def delete_sensor_threshold(): page = 1 # 接收页码 if request.values.get('page'): page = int(request.values.get('page')) id = request.values.get('id') obj = Sensor_threshold.query.filter(Sensor_threshold.id == id).first() delete(obj) sensor_thresholds = Sensor_threshold.query.paginate(page=page, per_page=10) return toJson(sensor_thresholds)
def delete_pond(): page = 1 # 接收页码 if request.values.get('page'): page = int(request.values.get('page')) pond_id = request.values.get('id') obj = Pond.query.filter(Pond.id == pond_id).first() delete(obj) ponds = Pond.query.paginate(page=page, per_page=10) return toJson(ponds)
def delete_item(cid, iid): item = model.category_item(cid, iid)[1] if item is not None: if not is_user() and item.user_id != login_session['user_id']: return redirect(url_for('login')) model.delete(item) flash("Item deleted successfully") else: flash("Oops some thing went wrong!") return redirect(url_for("home"))
def delete_alarm(): page = 1 # 接收页码 if request.values.get('page'): page = int(request.values.get('page')) id = request.values.get('id') obj = Alarm.query.filter(Alarm.id == id).first() delete(obj) alarms = Alarm.query.paginate(page=page, per_page=10) return toJson(alarms)
def delete_user(): page = 1 # 接收页码 if request.values.get('page'): page = int(request.values.get('page')) user_id = request.values.get('id') obj = User.query.filter(User.user_id == user_id).first() delete(obj) users = User.query.paginate(page=page, per_page=10) return toJson(users)