Add existing fields to the Rack Reservation user interface pages #6614

Closed
opened 2025-12-29 19:43:08 +01:00 by adam · 2 comments
Owner

Originally created by @atownson on GitHub (Jun 30, 2022).

Originally assigned to: @atownson on GitHub.

NetBox version

v3.2.4

Feature type

Change to existing functionality

Proposed functionality

Proposing to add already existent fields to the Rack Reservation create/edit/list user interface pages.

  1. Add the Site Group field to the Rack Reservation add and edit pages to filter the Site input.
    image
    image
  2. Add the Location field as a column option for the Rack Reservation list page.
    image
  3. Change the Rack section name in the filter tab for the Rack Reservation list page to Location.
    image

Site group and Location are already options as filters in the Rack Reservation list page.

Use case

The proposed changes would better align the user interface for the RackReservation model to other similar model pages (Rack) and provide additional filtering options.

Database changes

No response

External dependencies

No response

Originally created by @atownson on GitHub (Jun 30, 2022). Originally assigned to: @atownson on GitHub. ### NetBox version v3.2.4 ### Feature type Change to existing functionality ### Proposed functionality Proposing to add already existent fields to the Rack Reservation create/edit/list user interface pages. 1. Add the **Site Group** field to the Rack Reservation **add** and **edit** pages to filter the **Site** input. ![image](https://user-images.githubusercontent.com/52260120/176745821-87899598-5e02-45b8-8ffe-e76c310970f5.png) ![image](https://user-images.githubusercontent.com/52260120/176747807-a2209e4f-0e8f-45f4-adb3-7c129b5eff34.png) 2. Add the **Location** field as a column option for the Rack Reservation **list** page. ![image](https://user-images.githubusercontent.com/52260120/176746655-aa17532a-7c1f-40e9-8ba2-521d4ffa3963.png) 3. Change the **Rack** section name in the **filter** tab for the Rack Reservation **list** page to **Location**. ![image](https://user-images.githubusercontent.com/52260120/176749017-cef9d884-fc2f-451e-9839-16410e856a57.png) **Site group** and **Location** are already options as filters in the Rack Reservation list page. ### Use case The proposed changes would better align the user interface for the RackReservation model to other similar model pages (Rack) and provide additional filtering options. ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 19:43:08 +01:00
adam closed this issue 2025-12-29 19:43:08 +01:00
Author
Owner

@atownson commented on GitHub (Jul 1, 2022):

Item number 2 (add Location field) looks like it can be accomplished by updating the RackReservationTable class in netbox/dcim/tables/racks.py

class RackReservationTable(NetBoxTable):
    reservation = tables.Column(
        accessor='pk',
        linkify=True
    )
    site = tables.Column(
        accessor=Accessor('rack__site'),
        linkify=True
    )
    location = tables.Column(
        accessor=Accessor('rack__location'),
        linkify=True
    )
    tenant = TenantColumn()
    rack = tables.Column(
        linkify=True
    )
    unit_list = tables.Column(
        orderable=False,
        verbose_name='Units'
    )
    tags = columns.TagColumn(
        url_name='dcim:rackreservation_list'
    )

    class Meta(NetBoxTable.Meta):
        model = RackReservation
        fields = (
            'pk', 'id', 'reservation', 'site', 'location', 'rack', 'unit_list', 'user', 'created', 'tenant', 'description', 'tags',
            'actions', 'created', 'last_updated',
        )
        default_columns = ('pk', 'reservation', 'site', 'rack', 'unit_list', 'user', 'description')

This seems to work.

Item number 3 (change Rack to Location in the filter page) looks like it can be accomplished by updating the RackReservationFilterForm class in netbox/dcim/forms/filtersets.py

class RackReservationFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
    model = RackReservation
    fieldsets = (
        (None, ('q', 'tag')),
        ('User', ('user_id',)),
        ('Location', ('region_id', 'site_group_id', 'site_id', 'location_id')),
        ('Tenant', ('tenant_group_id', 'tenant_id')),
    )
...
@atownson commented on GitHub (Jul 1, 2022): Item number 2 (add Location field) looks like it can be accomplished by updating the RackReservationTable class in [netbox/dcim/tables/racks.py](https://github.com/netbox-community/netbox/blob/develop/netbox/dcim/tables/racks.py) ``` class RackReservationTable(NetBoxTable): reservation = tables.Column( accessor='pk', linkify=True ) site = tables.Column( accessor=Accessor('rack__site'), linkify=True ) location = tables.Column( accessor=Accessor('rack__location'), linkify=True ) tenant = TenantColumn() rack = tables.Column( linkify=True ) unit_list = tables.Column( orderable=False, verbose_name='Units' ) tags = columns.TagColumn( url_name='dcim:rackreservation_list' ) class Meta(NetBoxTable.Meta): model = RackReservation fields = ( 'pk', 'id', 'reservation', 'site', 'location', 'rack', 'unit_list', 'user', 'created', 'tenant', 'description', 'tags', 'actions', 'created', 'last_updated', ) default_columns = ('pk', 'reservation', 'site', 'rack', 'unit_list', 'user', 'description') ``` This seems to work. Item number 3 (change Rack to Location in the filter page) looks like it can be accomplished by updating the RackReservationFilterForm class in [netbox/dcim/forms/filtersets.py](https://github.com/netbox-community/netbox/blob/a52c68f4c2dffb6ea263711d37a997b082ece055/netbox/dcim/forms/filtersets.py) ``` class RackReservationFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm): model = RackReservation fieldsets = ( (None, ('q', 'tag')), ('User', ('user_id',)), ('Location', ('region_id', 'site_group_id', 'site_id', 'location_id')), ('Tenant', ('tenant_group_id', 'tenant_id')), ) ... ```
Author
Owner

@atownson commented on GitHub (Jul 13, 2022):

Item number 1 (add Site Group field) looks like it can be accomplished by adding site_group to the fieldsets property in the RackReservationForm class in netbox/dcim/forms/models.py

...
    fieldsets = (
        ('Reservation', ('region', 'site_group', 'site', 'location', 'rack', 'units', 'user', 'description', 'tags')),
        ('Tenancy', ('tenant_group', 'tenant')),
    )
...
@atownson commented on GitHub (Jul 13, 2022): Item number 1 (add Site Group field) looks like it can be accomplished by adding site_group to the fieldsets property in the RackReservationForm class in [netbox/dcim/forms/models.py](https://github.com/netbox-community/netbox/blob/develop/netbox/dcim/forms/models.py) ``` ... fieldsets = ( ('Reservation', ('region', 'site_group', 'site', 'location', 'rack', 'units', 'user', 'description', 'tags')), ('Tenancy', ('tenant_group', 'tenant')), ) ... ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6614