backend/passfinder/users/api/serializers.py

15 lines
362 B
Python
Raw Normal View History

2023-05-18 20:25:22 +03:00
from django.contrib.auth import get_user_model
from rest_framework import serializers
User = get_user_model()
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ["username", "name", "url"]
extra_kwargs = {
"url": {"view_name": "api:user-detail", "lookup_field": "username"}
}