Images have stopped displaying #14115
Replies: 5 comments 7 replies
-
I just noticed that I'm having the same issue and same error. I'm running 3.5.8 and was preparing to update to the latest version. The last command I ran was "wc -l" by accident instead of "ls -1 | wc -l" to get a total count of images to compare against the Netbox Image Attachment list. I didn't expect "wc -l" to modify anything. Could this cause the issue? |
Beta Was this translation helpful? Give feedback.
-
What exact URL was in the browser's URL bar at the time the exception occurred? That is, were you trying to look at the listing ( I suggest that when the error occurs again, get a full backtrace (set ADMINS and EMAIL in configuration.py and it will be E-mailed to you automatically; or wait until the problem occurs and set DEBUG=True and you'll get it in the web interface) It's quite possibly a bug. I see some references to "parent" in
And in the model:
These don't seem to have changed from 3.5.8 to 3.6.4 Also read through the later release notes, although I don't see any bugfixes for image attachments after 3.5.3, so it may not be fixed in 3.6.x |
Beta Was this translation helpful? Give feedback.
-
Brian,
Thank you for the email. I'm using the following URL:
https://netbox-server/extras/image-attachments from the left menu pane,
Customization, Image Attachments. Also, for locations or racks, the images
are no longer listed. The images are in fact in the media directory. I do
have some concern regarding the mismatch in permissions as shown below but
that may be irrelevant to this issue.
I was using 3.5.8 when I noticed the issue. I tried upgrading to 3.6.4,
which had no effect. I then restored a VM backup to 3.5.8 to the day before
I noticed the issue. The images worked properly at that time. Then, I
upgraded the restored VM to 3.6.4 and the images were still working
properly for a day or two. I'm not sure if the issue was caused by me
attempting to upload a new image but that's the only change I can think of
that could be related.
I have enabled debug and copied the results to a text file. Is it safe to
attach the full log to an email to you or could I encrypt it with your
public key? Here are the beginning debug details in yellow at the top of
the log if this helps.
FieldError at /extras/image-attachments/
Field 'parent' does not generate an automatic reverse relation and
therefore cannot be used for reverse querying. If it is a
GenericForeignKey, consider adding a GenericRelation.
Request Method: GET
Request URL: https://cone-svnetbox/extras/image-attachments/
Django Version: 4.2.6
Exception Type: FieldError
Exception Value:
Field 'parent' does not generate an automatic reverse relation and
therefore cannot be used for reverse querying. If it is a
GenericForeignKey, consider adding a GenericRelation.
Exception Location:
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/db/models/sql/query.py,
line 1700, in names_to_path
Raised during: extras.views.ImageAttachmentListView
Python Executable: /opt/netbox-3.6.4/venv/bin/python3
Python Version: 3.10.12
Python Path:
['/opt/netbox/netbox',
'/opt/netbox-3.6.4',
'/opt/netbox-3.6.4/venv/bin',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/opt/netbox-3.6.4/venv/lib/python3.10/site-packages']
Server time: Fri, 03 Nov 2023 16:27:59 +0000
Here is an example of the mismatch of the image file permissions between root and netbox that I
mentioned above.
/opt/netbox/netbox/media/image-attachments$ ls -l
total 194932
-rw-r--r-- 1 root root 2736337 Feb 17 2023 device_970_UPS_in_Rack_3.png
-rw-r--r-- 1 root root 2736337 Feb 17 2023 device_971_UPS_in_Rack_3.png
-rw-r--r-- 1 root root 3482887 Feb 17 2023
location_107_MDF_Rack_1_Top.png
-rw-r--r-- 1 root root 2804481 Feb 17 2023
location_107_Rack_1_Bottom.png
-rw-r--r-- 1 root root 2804481 Feb 17 2023
location_107_Rack_2_Bottom.png
-rw-r--r-- 1 root root 3200480 Feb 17 2023 location_107_Rack_2_Top.png
-rw-r--r-- 1 root root 2736337 Feb 17 2023
location_107_Rack_3_Bottom.png
-rw-r--r-- 1 root root 2724260 Feb 17 2023 location_107_Rack_3_Top.png
-rw-r--r-- 1 root root 750323 Feb 17 2023
location_10_IDF_Rack_1.png
-rw-r--r-- 1 netbox netbox 179548 Jul 25 19:46
location_114_MDF.jpg
-rw-r--r-- 1 netbox netbox 1555327 May 17 20:19
location_117_B-Front.jpg
-rw-r--r-- 1 netbox netbox 1153418 May 17 20:19
location_117_B-Rear.jpg
Thank you for your support,
Patrick McGlynn
…On Fri, Nov 3, 2023 at 3:34 AM Brian Candler ***@***.***> wrote:
What *exact* URL was in the browser's URL bar at the time the exception
occurred? That is, were you trying to look at the listing (
/extras/image-attachments/), or view one attachment (
/extras/image-attachments/N/), or you were in the edit view (
/extras/image-attachments/N/edit/)? Or did it only happen when you were
saving a change from the edit view?
I suggest that when the error occurs again, get a full backtrace (set
ADMINS and EMAIL in configuration.py and it will be E-mailed to you
automatically; or wait until the problem occurs and set DEBUG=True and
you'll get it in the web interface)
It's quite possibly a bug. I see some references to "parent" in
netbox/extras/views.py in the edit and delete views for image attachments:
@register_model_view(ImageAttachment, 'edit')
class ImageAttachmentEditView(generic.ObjectEditView):
...
def alter_object(self, instance, request, args, kwargs):
if not instance.pk:
# Assign the parent object based on URL kwargs
content_type = get_object_or_404(ContentType, pk=request.GET.get('content_type'))
instance.parent = get_object_or_404(content_type.model_class(), pk=request.GET.get('object_id'
))
return instance
def get_return_url(self, request, obj=None):
return obj.parent.get_absolute_url() if obj else super().get_return_url(request)
And in the model:
def to_objectchange(self, action):
objectchange = super().to_objectchange(action)
objectchange.related_object = self.parent
return objectchange
These don't seem to have changed from 3.5.8 to 3.6.4
Also read through the later release notes, although I don't see any
bugfixes for image attachments after 3.5.3, so it may not be fixed in 3.6.x
—
Reply to this email directly, view it on GitHub
<#14115 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJXE3UJLA6NTNNEMN6N4AVTYCSNBTAVCNFSM6AAAAAA6OPVPOSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TINRTHE4DQ>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Also, I followed the instructions to update the file permissions within the media directory. |
Beta Was this translation helpful? Give feedback.
-
Please see Issue #14247 for the solution. Thank you all for your assistance! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
HI new here to Netbox and really like it want to use it for documenting our sites and have been loving it but I have an issue with images no longer displaying.

Nothing appears in the images section of locations where the images were uploaded.
When I go to image attachment section under customisation I get this error.
Any help on this error is appreciated.
James
Beta Was this translation helpful? Give feedback.
All reactions