Skip to content

Commit

Permalink
feat(itam): Track if device is virtual
Browse files Browse the repository at this point in the history
ref: #244 closes #245
  • Loading branch information
jon-nfc committed Aug 23, 2024
1 parent 04a9cde commit 0020550
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/itam/forms/device/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Meta:
'uuid',
'device_type',
'organization',
'is_virtual',
'model_notes',
'config',
]
Expand Down Expand Up @@ -50,6 +51,7 @@ class DetailForm(DeviceForm):
],
"right": [
'model_notes',
'is_virtual',
]
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Generated by Django 5.0.7 on 2024-08-17 08:05

import itam.models.device
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('itam', '0002_device_config'),
]

operations = [
migrations.AlterModelOptions(
name='device',
options={'verbose_name_plural': 'Devices'},
),
migrations.AlterModelOptions(
name='devicemodel',
options={'ordering': ['manufacturer', 'name'], 'verbose_name_plural': 'Device Models'},
),
migrations.AlterModelOptions(
name='deviceoperatingsystem',
options={'verbose_name_plural': 'Device Operating Systems'},
),
migrations.AlterModelOptions(
name='devicesoftware',
options={'ordering': ['-action', 'software'], 'verbose_name_plural': 'Device Softwares'},
),
migrations.AlterModelOptions(
name='devicetype',
options={'verbose_name_plural': 'Device Types'},
),
migrations.AlterModelOptions(
name='operatingsystem',
options={'verbose_name_plural': 'Operating Systems'},
),
migrations.AlterModelOptions(
name='operatingsystemversion',
options={'verbose_name_plural': 'Operating System Versions'},
),
migrations.AlterModelOptions(
name='software',
options={'verbose_name_plural': 'Softwares'},
),
migrations.AlterModelOptions(
name='softwarecategory',
options={'verbose_name_plural': 'Software Categories'},
),
migrations.AlterModelOptions(
name='softwareversion',
options={'verbose_name_plural': 'Software Versions'},
),
migrations.AddField(
model_name='device',
name='is_virtual',
field=models.BooleanField(blank=True, default=False, help_text='Is this device a virtual machine', verbose_name='Is Virtual'),
),
migrations.AlterField(
model_name='device',
name='name',
field=models.CharField(max_length=50, unique=True, validators=[itam.models.device.Device.validate_hostname_format]),
),
migrations.AlterField(
model_name='device',
name='uuid',
field=models.CharField(blank=True, default=None, help_text='System GUID/UUID.', max_length=50, null=True, unique=True, validators=[itam.models.device.Device.validate_uuid_format], verbose_name='UUID'),
),
]
9 changes: 9 additions & 0 deletions app/itam/models/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ def validate_hostname_format(self):
blank = True,
)

is_virtual = models.BooleanField(
blank = True,
default = False,
help_text = 'Is this device a virtual machine',
null = False,
verbose_name = 'Is Virtual',
)


def save(
self, force_insert=False, force_update=False, using=None, update_fields=None
):
Expand Down

0 comments on commit 0020550

Please sign in to comment.