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

add get_display to users serializer

This commit is contained in:
Alex Gittings
2022-05-03 10:45:08 +00:00
parent 535606a185
commit 0a9ba3b2e6

View File

@ -44,6 +44,11 @@ class UserSerializer(ValidatedModelSerializer):
user.save()
return user
def get_display(self, obj):
if full_name := obj.get_full_name():
return f"{obj.username} ({full_name})"
return obj.username
class GroupSerializer(ValidatedModelSerializer):