Skip to content

Commit f3fe3f9

Browse files
committed
Closes #6708: Add image attachment support for circuits, power panels
1 parent 357a5d1 commit f3fe3f9

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

docs/release-notes/version-3.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Enhancements
66

77
* [#6423](https://github.com/netbox-community/netbox/issues/6423) - Cache rendered REST API specifications
8+
* [#6708](https://github.com/netbox-community/netbox/issues/6708) - Add image attachment support for circuits, power panels
89
* [#7387](https://github.com/netbox-community/netbox/issues/7387) - Enable arbitrary ordering of custom scripts
910

1011
### Bug Fixes

netbox/circuits/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django.contrib.contenttypes.fields import GenericRelation
12
from django.core.exceptions import ValidationError
23
from django.db import models
34
from django.urls import reverse
@@ -202,6 +203,9 @@ class Circuit(PrimaryModel):
202203
comments = models.TextField(
203204
blank=True
204205
)
206+
images = GenericRelation(
207+
to='extras.ImageAttachment'
208+
)
205209

206210
# Cache associated CircuitTerminations
207211
termination_a = models.ForeignKey(

netbox/dcim/models/power.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django.contrib.contenttypes.fields import GenericRelation
12
from django.core.exceptions import ValidationError
23
from django.core.validators import MaxValueValidator, MinValueValidator
34
from django.db import models
@@ -39,6 +40,9 @@ class PowerPanel(PrimaryModel):
3940
name = models.CharField(
4041
max_length=100
4142
)
43+
images = GenericRelation(
44+
to='extras.ImageAttachment'
45+
)
4246

4347
objects = RestrictedQuerySet.as_manager()
4448

netbox/templates/circuits/circuit.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ <h5 class="card-header">
7272
<div class="col col-md-6">
7373
{% include 'circuits/inc/circuit_termination.html' with termination=object.termination_a side='A' %}
7474
{% include 'circuits/inc/circuit_termination.html' with termination=object.termination_z side='Z' %}
75+
{% include 'inc/image_attachments_panel.html' %}
7576
{% plugin_right_page object %}
7677
</div>
7778
</div>

netbox/templates/dcim/powerpanel.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ <h5 class="card-header">
3939
</table>
4040
</div>
4141
</div>
42+
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:powerpanel_list' %}
4243
{% plugin_left_page object %}
4344
</div>
4445
<div class="col col-md-6">
4546
{% include 'inc/custom_fields_panel.html' %}
46-
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='dcim:powerpanel_list' %}
47+
{% include 'inc/image_attachments_panel.html' %}
4748
{% plugin_right_page object %}
4849
</div>
4950
</div>

0 commit comments

Comments
 (0)