@bp_rack.route('/<int:rack_id>/edit.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_edit.require(http_exception=403)
def edit(rack_id):
    '\n    货架编辑\n    '
    rack_info = get_rack_row_by_id(rack_id)
    if (not rack_info):
        abort(404)
    if (rack_info.status_delete == STATUS_DEL_OK):
        abort(410)
    template_name = 'rack/edit.html'
    form = RackEditForm(request.form)
    form.warehouse_id.choices = get_warehouse_choices(option_type='update')
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('rack edit')
    if (request.method == 'GET'):
        form.warehouse_id.data = rack_info.warehouse_id
        form.name.data = rack_info.name
        return render_template(template_name, rack_id=rack_id, form=form, **document_info)
    if (request.method == 'POST'):
        if (not form.validate_on_submit()):
            flash(_('Edit Failure'), 'danger')
            return render_template(template_name, rack_id=rack_id, form=form, **document_info)
        current_time = datetime.utcnow()
        rack_data = {'warehouse_id': form.warehouse_id.data, 'name': form.name.data, 'update_time': current_time}
        result = edit_rack(rack_id, rack_data)
        if result:
            flash(_('Edit Success'), 'success')
            return redirect((request.args.get('next') or url_for('rack.lists')))
        else:
            flash(_('Edit Failure'), 'danger')
            return render_template(template_name, rack_id=rack_id, form=form, **document_info)
货架编辑
@bp_rack.route('/<int:rack_id>/edit.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_edit.require(http_exception=403)
def edit(rack_id):
    '\n    \n    '
    rack_info = get_rack_row_by_id(rack_id)
    if (not rack_info):
        abort(404)
    if (rack_info.status_delete == STATUS_DEL_OK):
        abort(410)
    template_name = 'rack/edit.html'
    form = RackEditForm(request.form)
    form.warehouse_id.choices = get_warehouse_choices(option_type='update')
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('rack edit')
    if (request.method == 'GET'):
        form.warehouse_id.data = rack_info.warehouse_id
        form.name.data = rack_info.name
        return render_template(template_name, rack_id=rack_id, form=form, **document_info)
    if (request.method == 'POST'):
        if (not form.validate_on_submit()):
            flash(_('Edit Failure'), 'danger')
            return render_template(template_name, rack_id=rack_id, form=form, **document_info)
        current_time = datetime.utcnow()
        rack_data = {'warehouse_id': form.warehouse_id.data, 'name': form.name.data, 'update_time': current_time}
        result = edit_rack(rack_id, rack_data)
        if result:
            flash(_('Edit Success'), 'success')
            return redirect((request.args.get('next') or url_for('rack.lists')))
        else:
            flash(_('Edit Failure'), 'danger')
            return render_template(template_name, rack_id=rack_id, form=form, **document_info)