Skip to content

Commit

Permalink
Merge pull request #186 from elixir-luxembourg/185-Error-when-exporti…
Browse files Browse the repository at this point in the history
…ng-Contracts-to-Excel

null check added- fixes 185
  • Loading branch information
Pinar authored Jun 18, 2020
2 parents 8978928 + b3ecd1e commit 5ec9e97
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def to_dict(self):
'project': self.project,
'local_custodians': contact_dicts,
'OTHER_DATA': 'See models/contract.py'
# TODO: Some fields are missing, this might need to be continuted
# TODO: Some fields are missing, this might need to be continued
}
return base_dict

Expand All @@ -150,7 +150,9 @@ def serialize_to_export(self):
d = self.to_dict()

local_custodians = map(lambda v: f"[{v['first_name']} {v['last_name']}, {v['email']}]", d['local_custodians'])

d['local_custodians'] = ','.join(local_custodians)

d['project'] = d['project'].title
if 'project' in d and d['project']:
d['project'] = d['project'].title
return d

0 comments on commit 5ec9e97

Please sign in to comment.