api: do not fail on missing title
This commit is contained in:
parent
07e68ef209
commit
bcd28f4722
|
@ -263,7 +263,11 @@ class AppConfig(django.apps.AppConfig):
|
|||
del serializer.fields['last_login']
|
||||
|
||||
def get_gender(obj):
|
||||
title = obj.attributes.title
|
||||
attributes = obj.attributes
|
||||
try:
|
||||
title = attributes.title
|
||||
except AttributeError:
|
||||
return None
|
||||
return {'Monsieur': 'male', 'Madame': 'female'}.get(title)
|
||||
serializer.get_gender = get_gender
|
||||
|
||||
|
|
Loading…
Reference in New Issue