diff --git a/docs/release-notes/version-2.11.md b/docs/release-notes/version-2.11.md index 3a58069c6..e8fb8500a 100644 --- a/docs/release-notes/version-2.11.md +++ b/docs/release-notes/version-2.11.md @@ -11,6 +11,7 @@ * [#6121](https://github.com/netbox-community/netbox/issues/6121) - Extend parent interface assignment to VM interfaces * [#6125](https://github.com/netbox-community/netbox/issues/6125) - Add locations count to home page * [#6146](https://github.com/netbox-community/netbox/issues/6146) - Add bulk disconnect support for power feeds +* [#6149](https://github.com/netbox-community/netbox/issues/6149) - Support image attachments for locations * [#6150](https://github.com/netbox-community/netbox/issues/6150) - Enable change logging for journal entries ### Bug Fixes (from Beta) diff --git a/netbox/dcim/models/sites.py b/netbox/dcim/models/sites.py index 247735627..225a8e749 100644 --- a/netbox/dcim/models/sites.py +++ b/netbox/dcim/models/sites.py @@ -314,6 +314,9 @@ class Location(NestedGroupModel): max_length=200, blank=True ) + images = GenericRelation( + to='extras.ImageAttachment' + ) csv_headers = ['site', 'parent', 'name', 'slug', 'description'] clone_fields = ['site', 'parent', 'description'] diff --git a/netbox/dcim/urls.py b/netbox/dcim/urls.py index 534a9eec6..11ffd4458 100644 --- a/netbox/dcim/urls.py +++ b/netbox/dcim/urls.py @@ -55,6 +55,7 @@ urlpatterns = [ path('locations//edit/', views.LocationEditView.as_view(), name='location_edit'), path('locations//delete/', views.LocationDeleteView.as_view(), name='location_delete'), path('locations//changelog/', ObjectChangeLogView.as_view(), name='location_changelog', kwargs={'model': Location}), + path('locations//images/add/', ImageAttachmentEditView.as_view(), name='location_add_image', kwargs={'model': Location}), # Rack roles path('rack-roles/', views.RackRoleListView.as_view(), name='rackrole_list'), diff --git a/netbox/templates/dcim/location.html b/netbox/templates/dcim/location.html index 0efb74244..a5eeb4e71 100644 --- a/netbox/templates/dcim/location.html +++ b/netbox/templates/dcim/location.html @@ -58,6 +58,20 @@
{% include 'inc/custom_fields_panel.html' %} +
+
+ Images +
+ {% include 'inc/image_attachments.html' with images=object.images.all %} + {% if perms.extras.add_imageattachment %} + + {% endif %} +
{% plugin_right_page object %}