12826 make RackType.form_factor required

This commit is contained in:
Arthur Hanson 2024-08-30 09:51:12 -07:00
parent af93b47f94
commit 250fb078d5
2 changed files with 12 additions and 7 deletions

View File

@ -39,7 +39,7 @@ class Migration(migrations.Migration):
)),
('model', models.CharField(max_length=100)),
('slug', models.SlugField(max_length=100, unique=True)),
('form_factor', models.CharField(blank=True, max_length=50)),
('form_factor', models.CharField(max_length=50)),
('width', models.PositiveSmallIntegerField(default=19)),
('u_height', models.PositiveSmallIntegerField(
default=42,

View File

@ -41,12 +41,6 @@ class RackBase(WeightMixin, PrimaryModel):
"""
Base class for RackType & Rack. Holds
"""
form_factor = models.CharField(
choices=RackFormFactorChoices,
max_length=50,
blank=True,
verbose_name=_('form factor')
)
width = models.PositiveSmallIntegerField(
choices=RackWidthChoices,
default=RackWidthChoices.WIDTH_19IN,
@ -131,6 +125,11 @@ class RackType(RackBase):
Devices are housed within Racks. Each rack has a defined height measured in rack units, and a front and rear face.
Each Rack is assigned to a Site and (optionally) a Location.
"""
form_factor = models.CharField(
choices=RackFormFactorChoices,
max_length=50,
verbose_name=_('form factor')
)
manufacturer = models.ForeignKey(
to='dcim.Manufacturer',
on_delete=models.PROTECT,
@ -252,6 +251,12 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase):
'outer_unit', 'mounting_depth', 'weight', 'weight_unit', 'max_weight',
)
form_factor = models.CharField(
choices=RackFormFactorChoices,
max_length=50,
blank=True,
verbose_name=_('form factor')
)
rack_type = models.ForeignKey(
to='dcim.RackType',
on_delete=models.PROTECT,