@app.route('/v1/user/<int:id>', methods=['PUT'])
def edit_user(id):
    user = User.query.get_or_404(id)
    try:
        user = user_schema.load(request.form, instance=user)
    except ValidationError as errors:
        resp = jsonify(errors.messages)
        resp.status_code = 400
        return resp
    user.user_name = slugify(user.user_name)
    db.session.add(user)
    db.session.commit()
    location = url_for('get_user', id=user.id)
    resp = jsonify({'message': 'updated'})
    resp.status_code = 201
    resp.headers['location'] = location
    return resp
@app.route('/v1/user/<int:id>', methods=['PUT'])
def edit_user(id):
    user = User.query.get_or_404(id)
    try:
        user = user_schema.load(request.form, instance=user)
    except ValidationError as errors:
        resp = jsonify(errors.messages)
        resp.status_code = 400
        return resp
    user.user_name = slugify(user.user_name)
    db.session.add(user)
    db.session.commit()
    location = url_for('get_user', id=user.id)
    resp = jsonify({'message': 'updated'})
    resp.status_code = 201
    resp.headers['location'] = location
    return resp