mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-29 13:04:05 +03:00
Improve type hints for UserSerializer
(#4429)
* Improve type hints for UserSerializer * Fix NameError for UserType
This commit is contained in:
parent
a78f273846
commit
67a7194d06
|
@ -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" %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user