Automatically set device change timestamp on creation

This commit is contained in:
Kumi 2019-02-02 15:30:47 +00:00
parent 32764274dd
commit 8a62cd6ac5
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,23 @@
# Generated by Django 2.1.5 on 2019-02-02 15:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manager', '0042_auto_20190202_1318'),
]
operations = [
migrations.AlterField(
model_name='device',
name='changed',
field=models.DateTimeField(auto_now_add=True, verbose_name='Last Change of Device Config'),
),
migrations.AlterField(
model_name='device',
name='wifi',
field=models.ManyToManyField(blank=True, to='manager.Wifi'),
),
]

View file

@ -60,7 +60,7 @@ class Device(models.Model):
firmware = models.DateTimeField("Firmware Creation Time", blank=True, null=True, editable=False)
update = models.BooleanField("Trigger Firmware Update", default=False)
reboot = models.BooleanField("Trigger Reboot", default=False)
changed = models.DateTimeField("Last Change of Device Config")
changed = models.DateTimeField("Last Change of Device Config", auto_now_add=True)
wireless = models.DateTimeField("Last Update of Wireless Config", blank=True, null=True, editable=False)
def __str__(self):