1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #6149: Support image attachments for locations

This commit is contained in:
jeremystretch
2021-04-13 11:39:04 -04:00
parent e5602abee0
commit b1d20d3228
4 changed files with 19 additions and 0 deletions

View File

@ -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)

View File

@ -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']

View File

@ -55,6 +55,7 @@ urlpatterns = [
path('locations/<int:pk>/edit/', views.LocationEditView.as_view(), name='location_edit'),
path('locations/<int:pk>/delete/', views.LocationDeleteView.as_view(), name='location_delete'),
path('locations/<int:pk>/changelog/', ObjectChangeLogView.as_view(), name='location_changelog', kwargs={'model': Location}),
path('locations/<int:object_id>/images/add/', ImageAttachmentEditView.as_view(), name='location_add_image', kwargs={'model': Location}),
# Rack roles
path('rack-roles/', views.RackRoleListView.as_view(), name='rackrole_list'),

View File

@ -58,6 +58,20 @@
</div>
<div class="col-md-6">
{% include 'inc/custom_fields_panel.html' %}
<div class="panel panel-default">
<div class="panel-heading">
<strong>Images</strong>
</div>
{% include 'inc/image_attachments.html' with images=object.images.all %}
{% if perms.extras.add_imageattachment %}
<div class="panel-footer text-right noprint">
<a href="{% url 'dcim:location_add_image' object_id=object.pk %}" class="btn btn-primary btn-xs">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span>
Attach an image
</a>
</div>
{% endif %}
</div>
{% plugin_right_page object %}
</div>
</div>