mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #6154: Allow decimal values for cable lengths
This commit is contained in:
16
netbox/dcim/migrations/0132_cable_length.py
Normal file
16
netbox/dcim/migrations/0132_cable_length.py
Normal file
@ -0,0 +1,16 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dcim', '0131_consoleport_speed'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='cable',
|
||||
name='length',
|
||||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=8, null=True),
|
||||
),
|
||||
]
|
@ -74,7 +74,9 @@ class Cable(PrimaryModel):
|
||||
color = ColorField(
|
||||
blank=True
|
||||
)
|
||||
length = models.PositiveSmallIntegerField(
|
||||
length = models.DecimalField(
|
||||
max_digits=8,
|
||||
decimal_places=2,
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
|
@ -60,7 +60,7 @@
|
||||
<th scope="row">Length</th>
|
||||
<td>
|
||||
{% if object.length %}
|
||||
{{ object.length }} {{ object.get_length_unit_display }}
|
||||
{{ object.length|floatformat }} {{ object.get_length_unit_display }}
|
||||
{% else %}
|
||||
<span class="text-muted">—</span>
|
||||
{% endif %}
|
||||
|
@ -10,7 +10,7 @@
|
||||
<span class="badge bg-secondary">{{ cable.get_type_display|default:"" }}</span>
|
||||
{% endif %}
|
||||
{% if cable.length %}
|
||||
({{ cable.length }} {{ cable.get_length_unit_display }})<br />
|
||||
({{ cable.length|floatformat }} {{ cable.get_length_unit_display }})<br />
|
||||
{% endif %}
|
||||
<span class="badge bg-{{ cable.get_status_class }}">{{ cable.get_status_display }}</span><br />
|
||||
{% for tag in cable.tags.all %}
|
||||
|
Reference in New Issue
Block a user