diff --git a/ninja_jwt/schema.py b/ninja_jwt/schema.py index f65d82736..6e8ad72ab 100644 --- a/ninja_jwt/schema.py +++ b/ninja_jwt/schema.py @@ -4,11 +4,11 @@ from django.contrib.auth import authenticate, get_user_model from django.contrib.auth.models import AbstractUser, update_last_login from django.utils.translation import gettext_lazy as _ -from ninja.orm import create_schema -from ninja_jwt.utils import token_error from ninja_schema import ModelSchema, Schema from pydantic import root_validator +from ninja_jwt.utils import token_error + from . import exceptions from .settings import api_settings from .tokens import RefreshToken, SlidingToken, Token, UntypedToken @@ -19,7 +19,10 @@ user_name_field = get_user_model().USERNAME_FIELD # type: ignore -AuthUserSchema = create_schema(get_user_model(), fields=[user_name_field]) +class AuthUserSchema(ModelSchema): + class Config: + model = get_user_model() + include = [user_name_field] class TokenObtainSerializer(ModelSchema):