Skip to content

Commit 6ef333e

Browse files
Fixes #12885: Permit mounting of devices in U100 (#12901)
* Fixes #12885: Permit mounting of devices in U100 * Define a RACK_U_HEIGHT_MAX constant
1 parent 7fc69f3 commit 6ef333e

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

netbox/dcim/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#
1212

1313
RACK_U_HEIGHT_DEFAULT = 42
14+
RACK_U_HEIGHT_MAX = 100
1415

1516
RACK_ELEVATION_BORDER_WIDTH = 2
1617
RACK_ELEVATION_DEFAULT_LEGEND_WIDTH = 30

netbox/dcim/migrations/0154_half_height_rack_units.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ class Migration(migrations.Migration):
1818
migrations.AlterField(
1919
model_name='device',
2020
name='position',
21-
field=models.DecimalField(blank=True, decimal_places=1, max_digits=4, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(99.5)]),
21+
field=models.DecimalField(blank=True, decimal_places=1, max_digits=4, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100.5)]),
2222
),
2323
]

netbox/dcim/models/devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ class Device(PrimaryModel, ConfigContextModel):
568568
decimal_places=1,
569569
blank=True,
570570
null=True,
571-
validators=[MinValueValidator(1), MaxValueValidator(99.5)],
571+
validators=[MinValueValidator(1), MaxValueValidator(RACK_U_HEIGHT_MAX + 0.5)],
572572
verbose_name='Position (U)',
573573
help_text=_('The lowest-numbered unit occupied by the device')
574574
)

netbox/dcim/models/racks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class Rack(PrimaryModel, WeightMixin):
126126
u_height = models.PositiveSmallIntegerField(
127127
default=RACK_U_HEIGHT_DEFAULT,
128128
verbose_name='Height (U)',
129-
validators=[MinValueValidator(1), MaxValueValidator(100)],
129+
validators=[MinValueValidator(1), MaxValueValidator(RACK_U_HEIGHT_MAX)],
130130
help_text=_('Height in rack units')
131131
)
132132
desc_units = models.BooleanField(

0 commit comments

Comments
 (0)