Improve type hints for UserSerializer (#4429)

* Improve type hints for UserSerializer

* Fix NameError for UserType
This commit is contained in:
Bruno Alla 2023-07-11 15:11:24 +02:00 committed by GitHub
parent a78f273846
commit 67a7194d06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,10 +1,13 @@
from django.contrib.auth import get_user_model
from rest_framework import serializers
from {{ cookiecutter.project_slug }}.users.models import User as UserType
User = get_user_model()
class UserSerializer(serializers.ModelSerializer):
class UserSerializer(serializers.ModelSerializer[UserType]):
class Meta:
model = User
{%- if cookiecutter.username_type == "email" %}