Repository: netbox-community/netbox

Issue:
Extend Rack Reservations Table-View with Site Information
<!--
    NOTE: This form is only for proposing specific new features or enhancements.
    If you have a general idea or question, please post to our mailing list
    instead of opening an issue:

        https://groups.google.com/forum/#!forum/netbox-discuss

    NOTE: Due to an excessive backlog of feature requests, we are not currently
    accepting any proposals which significantly extend NetBox's feature scope.

    Please describe the environment in which you are running NetBox. Be sure
    that you are running an unmodified instance of the latest stable release
    before submitting a bug report.
-->
### Environment
* Python version: 3.6  <!-- Example: 3.5.4 -->
* NetBox version: 2.5.11 <!-- Example: 2.3.6 -->

<!--
    Describe in detail the new functionality you are proposing. Include any
    specific changes to work flows, data models, or the user interface.
-->
### Proposed Functionality
On  the ``Rack Reservations`` Overview-Page ``/dcim/rack-reservations/`` we should Display the ``Site`` Name in Table-Overview too.

<!--
    Convey an example use case for your proposed feature. Write from the
    perspective of a NetBox user who would benefit from the proposed
    functionality and describe how.
--->
### Use Case
If you check your ``Rack Reservations`` you could see the ``Rack`` and maybe the ``Tenant`` if Information is given.
To make the overview even easier, the first column should contain the corresponding ``Site``. 

![image](https://user-images.githubusercontent.com/932481/57210464-01ca4700-6fdd-11e9-8b61-7dce13f4425d.png)


<!--
    Note any changes to the database schema necessary to support the new
    feature. For example, does the proposal require adding a new model or
    field? (Not all new features require database changes.)
--->
### Database Changes
None.

<!--
    List any new dependencies on external libraries or services that this new
    feature would introduce. For example, does the proposal require the
    installation of a new Python package? (Not all new features introduce new
    dependencies.)
-->
### External Dependencies
None.


Discussion:

Resolving patch:
diff --git a/netbox/dcim/tables.py b/netbox/dcim/tables.py
--- a/netbox/dcim/tables.py
+++ b/netbox/dcim/tables.py
@@ -305,6 +305,11 @@ class Meta(RackTable.Meta):
 
 class RackReservationTable(BaseTable):
     pk = ToggleColumn()
+    site = tables.LinkColumn(
+        viewname='dcim:site',
+        accessor=Accessor('rack.site'),
+        args=[Accessor('rack.site.slug')],
+    )
     tenant = tables.TemplateColumn(template_code=COL_TENANT)
     rack = tables.LinkColumn('dcim:rack', args=[Accessor('rack.pk')])
     unit_list = tables.Column(orderable=False, verbose_name='Units')
@@ -314,7 +319,7 @@ class RackReservationTable(BaseTable):
 
     class Meta(BaseTable.Meta):
         model = RackReservation
-        fields = ('pk', 'rack', 'unit_list', 'user', 'created', 'tenant', 'description', 'actions')
+        fields = ('pk', 'site', 'rack', 'unit_list', 'user', 'created', 'tenant', 'description', 'actions')
 
 
 #
diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py
--- a/netbox/dcim/views.py
+++ b/netbox/dcim/views.py
@@ -458,7 +458,7 @@ class RackBulkDeleteView(PermissionRequiredMixin, BulkDeleteView):
 #
 
 class RackReservationListView(ObjectListView):
-    queryset = RackReservation.objects.all()
+    queryset = RackReservation.objects.select_related('rack__site')
     filter = filters.RackReservationFilter
     filter_form = forms.RackReservationFilterForm
     table = tables.RackReservationTable


Test patch: