Add room size input in meters alongside centimeters
The floor plan form and the designer accept a room size like "4 x 3" (meters), show dimensions in meters on the plan edges, in the table, detail page and tooltips, and display the floor area. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
53ffda1773
commit
ab8ab7ed61
10 files changed
+152
-14
No files matched your search
@@ -3,6 +3,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
|
||||
from .models import FloorPlan
|
||||
from .utils import format_room_size
|
||||
|
||||
__all__ = ('FloorPlanTable',)
|
||||
|
||||
@@ -11,6 +12,7 @@ class FloorPlanTable(NetBoxTable):
|
||||
name = tables.Column(verbose_name=_('Name'), linkify=True)
|
||||
site = tables.Column(verbose_name=_('Site'), linkify=True)
|
||||
location = tables.Column(verbose_name=_('Location'), linkify=True)
|
||||
room_size = tables.Column(verbose_name=_('Room size (m)'), empty_values=(), orderable=False)
|
||||
width = tables.Column(verbose_name=_('Width (cm)'))
|
||||
depth = tables.Column(verbose_name=_('Depth (cm)'))
|
||||
item_count = tables.Column(verbose_name=_('Items'))
|
||||
@@ -20,7 +22,10 @@ class FloorPlanTable(NetBoxTable):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = FloorPlan
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'site', 'location', 'width', 'depth', 'grid_size', 'item_count', 'rack_count',
|
||||
'description', 'tags', 'created', 'last_updated',
|
||||
'pk', 'id', 'name', 'site', 'location', 'room_size', 'width', 'depth', 'grid_size', 'item_count',
|
||||
'rack_count', 'description', 'tags', 'created', 'last_updated',
|
||||
)
|
||||
default_columns = ('name', 'site', 'location', 'width', 'depth', 'rack_count', 'description')
|
||||
default_columns = ('name', 'site', 'location', 'room_size', 'rack_count', 'description')
|
||||
|
||||
def render_room_size(self, record):
|
||||
return f'{format_room_size(record.width, record.depth)} m'
|
||||
Reference in new issue
Block a user