mirror of
https://github.com/fergalmoran/dss.api.git
synced 2025-12-22 09:18:13 +00:00
13 lines
305 B
Python
13 lines
305 B
Python
from rest_framework.fields import Field
|
|
|
|
|
|
class DisplayNameField(Field):
|
|
def to_internal_value(self, data):
|
|
return data
|
|
|
|
def to_representation(self, value):
|
|
if not value:
|
|
return self.parent.data['first_name'] + ' ' + self.parent.data['last_name']
|
|
return value
|
|
|