Beispiel #1
0
async def get(username: str, fetch_password: bool = False) -> User_Pydantic:
    try:
        if fetch_password:
            user = await UserIn_Pydantic.from_queryset_single(User.get(username=username))
        else:
            user = await User_Pydantic.from_queryset_single(User.get(username=username))
        return user

    except DoesNotExist:
        raise NotImplementedException
Beispiel #2
0
def func() -> str:
    user = User.get(id=1)
    if user is not None:
        return jsonify(user.serialize)
    return jsonify({'error': 1})