Skip to content

Commit

Permalink
Switched to ModelSchema to avoid extra import
Browse files Browse the repository at this point in the history
  • Loading branch information
demiurg committed Mar 19, 2022
1 parent 67716a3 commit d09bc97
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ninja_jwt/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit d09bc97

Please sign in to comment.