A api update

pull/22/head
雷二猛 2019-12-06 00:46:30 +08:00
parent 511ecd10b5
commit 612379e7e2
2 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ class Alarm(models.Model, ModelMixin):
def to_dict(self, *args, **kwargs):
tmp = super().to_dict(*args, **kwargs)
tmp['notify_mode'] = json.loads(self.notify_mode)
tmp['notify_mode'] = ','.join(dict(self.MODES)[x] for x in json.loads(self.notify_mode))
tmp['notify_grp'] = json.loads(self.notify_grp)
tmp['status_alias'] = self.get_status_display()
return tmp

View File

@ -26,7 +26,7 @@ class Scheduler:
duration = seconds_to_human(time.time() - obj.latest_fault_time)
Alarm.objects.create(
name=obj.name,
type=obj.type,
type=obj.get_type_display(),
status=status,
duration=duration,
notify_grp=obj.notify_grp,