Added better support for custom user models by not requiring a first_name attribute

This commit is contained in:
Alexander Skvortsov 2020-01-06 22:18:48 -05:00
parent 84456aca23
commit 377e1c3250

View File

@ -46,8 +46,8 @@ class DatatablesTicketSerializer(serializers.ModelSerializer):
def get_assigned_to(self, obj):
if obj.assigned_to:
if obj.assigned_to.first_name:
return (obj.assigned_to.first_name)
if obj.assigned_to.get_full_name():
return (obj.assigned_to.get_full_name())
else:
return (obj.assigned_to.email)
else: