Device Model
Bases: DeviceCommonFieldsName
, SaveHistory
Attributes
reserved_config_keys: list = ['software']
name = models.CharField(blank=False, help_text='Hostname of this device', max_length=50, unique=True, validators=[validate_hostname_format], verbose_name='Name')
serial_number = models.CharField(blank=True, default=None, help_text='Serial number of the device.', max_length=50, null=True, unique=True, verbose_name='Serial Number')
uuid = models.CharField(blank=True, default=None, help_text='System GUID/UUID.', max_length=50, null=True, unique=True, validators=[validate_uuid_format], verbose_name='UUID')
device_model = models.ForeignKey(DeviceModel, blank=True, default=None, help_text='Model of the device.', null=True, on_delete=models.SET_DEFAULT, verbose_name='Model')
device_type = models.ForeignKey(DeviceType, blank=True, default=None, help_text='Type of device.', null=True, on_delete=models.SET_DEFAULT, verbose_name='Type')
config = models.JSONField(blank=True, default=None, help_text='Configuration for this device', null=True, validators=[validate_config_keys_not_reserved], verbose_name='Host Configuration')
inventorydate = models.DateTimeField(blank=True, help_text='Date and time of the last inventory', null=True, verbose_name='Last Inventory Date')
is_virtual = models.BooleanField(blank=True, default=False, help_text='Is this device a virtual machine', null=False, verbose_name='Is Virtual')
table_fields: list = ['status_icon', 'name', 'device_model', 'device_type', 'organization', 'created', 'modified', 'model', 'nbsp']
page_layout: dict = [{'name': 'Details', 'slug': 'details', 'sections': [{'layout': 'double', 'left': ['organization', 'device_type', 'device_model', 'name', 'serial_number', 'uuid', 'inventorydate', 'created', 'modified'], 'right': ['model_notes', 'is_virtual', 'is_global']}, {'layout': 'table', 'name': 'Operating System', 'field': 'operating_system'}, {'layout': 'table', 'name': 'Dependent Services', 'field': 'service'}, {'layout': 'single', 'fields': ['config']}]}, {'name': 'Software', 'slug': 'software', 'sections': [{'layout': 'table', 'field': 'software'}]}, {'name': 'Tickets', 'slug': 'tickets', 'sections': [{'layout': 'table', 'field': 'tickets'}]}, {'name': 'Notes', 'slug': 'notes', 'sections': []}, {'name': 'Config Management', 'slug': 'config_management', 'sections': [{'layout': 'single', 'fields': ['rendered_config']}]}]
status_icon: list([Icon])
status: str
Fetch Device status
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Current status of the item |
get_configuration
Classes
Meta
Attributes
ordering = ['name', 'organization']
verbose_name = 'Device'
verbose_name_plural = 'Devices'
Functions
validate_config_keys_not_reserved()
validate_uuid_format()
validate_hostname_format()
save(force_insert=False, force_update=False, using=None, update_fields=None)
Save Device Model
After saving the device update the related items so that they are a part of the same organization as the device.
__str__()
About:
This page forms part of our Project Centurion ERP.
Page Metadata
Version: ToDo: place files short git commit hereDate Created: 2024-06-16
Date Edited: 2024-07-13
Contribution:
Would You like to contribute to our Centurion ERP project? You can assist in the following ways:
- Edit This Page If there is a mistake or a way you can improve it.
- Add a Page to the Manual if you would like to add an item to our manual
- Raise an Issue if there is something about this page you would like to improve, and git is unfamiliar to you.
ToDo: Add the page list of contributors