From 3e851cb046c762be5d4c6bc45b86551370f419a6 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Mon, 2 Dec 2019 02:17:37 +0000 Subject: [PATCH] add severity field to Update model --- .../migrations/0004_winupdate_severity.py | 18 ++++++++++++++++++ api/djangormm/winupdate/models.py | 1 + api/djangormm/winupdate/tasks.py | 6 ++++-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 api/djangormm/winupdate/migrations/0004_winupdate_severity.py diff --git a/api/djangormm/winupdate/migrations/0004_winupdate_severity.py b/api/djangormm/winupdate/migrations/0004_winupdate_severity.py new file mode 100644 index 00000000..986d4528 --- /dev/null +++ b/api/djangormm/winupdate/migrations/0004_winupdate_severity.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.7 on 2019-12-02 02:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('winupdate', '0003_auto_20191201_0426'), + ] + + operations = [ + migrations.AddField( + model_name='winupdate', + name='severity', + field=models.CharField(blank=True, max_length=255, null=True), + ), + ] diff --git a/api/djangormm/winupdate/models.py b/api/djangormm/winupdate/models.py index 27687aff..c1b2f250 100644 --- a/api/djangormm/winupdate/models.py +++ b/api/djangormm/winupdate/models.py @@ -11,6 +11,7 @@ class WinUpdate(models.Model): installed = models.BooleanField(default=False) downloaded = models.BooleanField(default=False) description = models.TextField(null=True) + severity = models.CharField(max_length=255, null=True, blank=True) def __str__(self): return self.agent.hostname diff --git a/api/djangormm/winupdate/tasks.py b/api/djangormm/winupdate/tasks.py index 69e8d124..f568caf6 100644 --- a/api/djangormm/winupdate/tasks.py +++ b/api/djangormm/winupdate/tasks.py @@ -34,7 +34,8 @@ def check_for_updates_task(pk): needs_reboot=ret[i]["NeedsReboot"], installed=ret[i]["Installed"], downloaded=ret[i]["Downloaded"], - description=ret[i]["Description"] + description=ret[i]["Description"], + severity=ret[i]["Severity"] ).save() else: for i in guids: @@ -58,6 +59,7 @@ def check_for_updates_task(pk): needs_reboot=ret[i]["NeedsReboot"], installed=ret[i]["Installed"], downloaded=ret[i]["Downloaded"], - description=ret[i]["Description"] + description=ret[i]["Description"], + severity=ret[i]["Severity"] ).save() return "ok" \ No newline at end of file