add severity field to Update model

This commit is contained in:
wh1te909 2019-12-02 02:17:37 +00:00
parent ce79421698
commit 3e851cb046
3 changed files with 23 additions and 2 deletions

View File

@ -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),
),
]

View File

@ -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

View File

@ -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"