From 67a7194d06d45a2aa87840c5e5ebefeda86c9325 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Tue, 11 Jul 2023 15:11:24 +0200 Subject: [PATCH] Improve type hints for `UserSerializer` (#4429) * Improve type hints for UserSerializer * Fix NameError for UserType --- .../{{cookiecutter.project_slug}}/users/api/serializers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/api/serializers.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/api/serializers.py index 6b26367d..0872d06f 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/api/serializers.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/api/serializers.py @@ -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" %}