def user_create(): obj = User() obj.mass_assign(request.json) if not obj.is_valid: return jsonify(errors=obj.validation_errors), 422 if request.json.get('password', '') not in ['', None]: obj.password = encrypt_password(request.json['password']) db.session.add(obj) db.session.commit() return jsonify(**obj.to_dict())
def users_list(): ary = User.all() return jsonarify(ary)