Tweak status code rendering for upgrades API view
This commit is contained in:
parent
22ef6aad7b
commit
31ae5eacd5
|
@ -38,15 +38,19 @@ class UpgradeView(APIMasterView):
|
|||
model_class = model.Upgrade
|
||||
|
||||
def normalize(self, upgrade):
|
||||
return {
|
||||
data = {
|
||||
'created': upgrade.created.isoformat(),
|
||||
'description': upgrade.description,
|
||||
'enabled': upgrade.enabled,
|
||||
'status_code': self.enum.UPGRADE_STATUS.get(upgrade.status_code,
|
||||
six.text_type(upgrade.status_code)),
|
||||
'executed': upgrade.executed.isoformat() if upgrade.executed else None,
|
||||
# 'executed_by':
|
||||
}
|
||||
if upgrade.status_code is None:
|
||||
data['status_code'] = None
|
||||
else:
|
||||
data['status_code'] = self.enum.UPGRADE_STATUS.get(upgrade.status_code,
|
||||
six.text_type(upgrade.status_code))
|
||||
return data
|
||||
|
||||
|
||||
def includeme(config):
|
||||
|
|
Loading…
Reference in a new issue