1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #9608: Move from drf-yasg to spectacular

Co-authored-by: arthanson <worldnomad@gmail.com>
Co-authored-by: jeremystretch <jstretch@netboxlabs.com>
This commit is contained in:
Arthur Hanson
2023-03-30 11:32:59 -07:00
committed by GitHub
parent 1be626e5ee
commit ecd0c56554
35 changed files with 514 additions and 340 deletions

View File

@ -1,6 +1,8 @@
from django.conf import settings
from django.contrib.auth.models import Group, User
from django.contrib.contenttypes.models import ContentType
from drf_spectacular.utils import extend_schema_field
from drf_spectacular.types import OpenApiTypes
from rest_framework import serializers
from netbox.api.fields import ContentTypeField, IPNetworkSerializer, SerializedPKRelatedField
@ -47,6 +49,7 @@ class UserSerializer(ValidatedModelSerializer):
return user
@extend_schema_field(OpenApiTypes.STR)
def get_display(self, obj):
if full_name := obj.get_full_name():
return f"{obj.username} ({full_name})"