Unable to View Image Attachments #8831

Closed
opened 2025-12-29 20:41:49 +01:00 by adam · 8 comments
Owner

Originally created by @bmp521 on GitHub (Nov 10, 2023).

Please see Discussion #14115

NetBox version

3.6.4

Python version

3.10

Steps to Reproduce

  1. Click Customization
  2. Click Image Attachments

Expected Behavior

View list of image attachments

Observed Behavior

Server Error
There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'django.core.exceptions.FieldError'>

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.

Python version: 3.10.12
NetBox version: 3.6.4
Plugins: None installed
Originally created by @bmp521 on GitHub (Nov 10, 2023). Please see Discussion #14115 ### NetBox version 3.6.4 ### Python version 3.10 ### Steps to Reproduce 1. Click Customization 2. Click Image Attachments ### Expected Behavior View list of image attachments ### Observed Behavior Server Error There was a problem with your request. Please contact an administrator. The complete exception is provided below: ``` <class 'django.core.exceptions.FieldError'> 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. Python version: 3.10.12 NetBox version: 3.6.4 Plugins: None installed ```
adam added the type: bugstatus: needs ownerseverity: low labels 2025-12-29 20:41:49 +01:00
adam closed this issue 2025-12-29 20:41:49 +01:00
Author
Owner

@bmp521 commented on GitHub (Nov 10, 2023):

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
Traceback Switch to copy-and-paste view
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/core/handlers/exception.py, line 55, in inner
                response = get_response(request) …
Local vars
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/core/handlers/base.py, line 197, in _get_response
                response = wrapped_callback(request, *callback_args, **callback_kwargs) …
Local vars
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/views/generic/base.py, line 104, in view
            return self.dispatch(request, *args, **kwargs) …
Local vars
/opt/netbox/netbox/netbox/views/generic/base.py, line 77, in dispatch
        return super().dispatch(request, *args, **kwargs) …
Local vars
/opt/netbox/netbox/utilities/views.py, line 99, in dispatch
        return super().dispatch(request, *args, **kwargs) …
Local vars
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/views/generic/base.py, line 143, in dispatch
        return handler(request, *args, **kwargs) …
Local vars
/opt/netbox/netbox/netbox/views/generic/bulk_views.py, line 163, in get
        table = self.get_table(self.queryset, request, has_bulk_actions) …
Local vars
/opt/netbox/netbox/netbox/views/generic/mixins.py, line 47, in get_table
        table.configure(request) …
Local vars
/opt/netbox/netbox/netbox/tables/tables.py, line 156, in configure
                self.order_by = ordering …
Local vars
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django_tables2/tables.py, line 542, in order_by
        self.data.order_by(self._order_by) …
Local vars
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django_tables2/data.py, line 224, in order_by
            self.data = self.data.order_by(*order_by_accessors) …
Local vars
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/db/models/query.py, line 1659, in order_by
        obj.query.add_ordering(*field_names) …
Local vars
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/db/models/sql/query.py, line 2221, in add_ordering
                self.names_to_path(item.split(LOOKUP_SEP), self.model._meta) …
Local vars
/opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/db/models/sql/query.py, line 1700, in names_to_path
                    raise FieldError( …
Local vars
Request information
USER
user

GET
No GET data

POST
No POST data

FILES
No FILES data
@bmp521 commented on GitHub (Nov 10, 2023): ``` 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 Traceback Switch to copy-and-paste view /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/core/handlers/exception.py, line 55, in inner response = get_response(request) … Local vars /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/core/handlers/base.py, line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) … Local vars /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/views/generic/base.py, line 104, in view return self.dispatch(request, *args, **kwargs) … Local vars /opt/netbox/netbox/netbox/views/generic/base.py, line 77, in dispatch return super().dispatch(request, *args, **kwargs) … Local vars /opt/netbox/netbox/utilities/views.py, line 99, in dispatch return super().dispatch(request, *args, **kwargs) … Local vars /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/views/generic/base.py, line 143, in dispatch return handler(request, *args, **kwargs) … Local vars /opt/netbox/netbox/netbox/views/generic/bulk_views.py, line 163, in get table = self.get_table(self.queryset, request, has_bulk_actions) … Local vars /opt/netbox/netbox/netbox/views/generic/mixins.py, line 47, in get_table table.configure(request) … Local vars /opt/netbox/netbox/netbox/tables/tables.py, line 156, in configure self.order_by = ordering … Local vars /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django_tables2/tables.py, line 542, in order_by self.data.order_by(self._order_by) … Local vars /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django_tables2/data.py, line 224, in order_by self.data = self.data.order_by(*order_by_accessors) … Local vars /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/db/models/query.py, line 1659, in order_by obj.query.add_ordering(*field_names) … Local vars /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/db/models/sql/query.py, line 2221, in add_ordering self.names_to_path(item.split(LOOKUP_SEP), self.model._meta) … Local vars /opt/netbox-3.6.4/venv/lib/python3.10/site-packages/django/db/models/sql/query.py, line 1700, in names_to_path raise FieldError( … Local vars Request information USER user GET No GET data POST No POST data FILES No FILES data ```
Author
Owner

@MrFoxTrot commented on GitHub (Nov 13, 2023):

Got same error when set sort on ImageAttachmentsTable by this field

@MrFoxTrot commented on GitHub (Nov 13, 2023): Got same error when set sort on ImageAttachmentsTable by this field
Author
Owner

@bmp521 commented on GitHub (Nov 13, 2023):

I'm not able to load the Image Attachment page and the location/rack page does not show the pictures.

@bmp521 commented on GitHub (Nov 13, 2023): I'm not able to load the Image Attachment page and the location/rack page does not show the pictures.
Author
Owner

@jeremystretch commented on GitHub (Nov 14, 2023):

I'm not able to reproduce this on NetBox v3.6.5. Best I can guess, maybe you somehow have an ImageAttachment assigned to an object which doesn't have the reverse relationship? But this should exist for all core models, and you don't appear to have any plugins installed.

@jeremystretch commented on GitHub (Nov 14, 2023): I'm not able to reproduce this on NetBox v3.6.5. Best I can guess, maybe you somehow have an ImageAttachment assigned to an object which doesn't have the reverse relationship? But this should exist for all core models, and you don't appear to have any plugins installed.
Author
Owner

@MrFoxTrot commented on GitHub (Nov 14, 2023):

I'm not able to reproduce this on NetBox v3.6.5. Best I can guess, maybe you somehow have an ImageAttachment assigned to an object which doesn't have the reverse relationship? But this should exist for all core models, and you don't appear to have any plugins installed.

Steps to reproduce:

  1. Navigate to extras > image-attachments
  2. Select order by parent.
  3. Reload Page

Work around:

  1. Navigate to user > preferences
  2. Reset Table Configuration for "ImageAttachmentTable"
@MrFoxTrot commented on GitHub (Nov 14, 2023): > I'm not able to reproduce this on NetBox v3.6.5. Best I can guess, maybe you somehow have an ImageAttachment assigned to an object which doesn't have the reverse relationship? But this should exist for all core models, and you don't appear to have any plugins installed. Steps to reproduce: 1) Navigate to extras > image-attachments 2) Select order by parent. 3) Reload Page Work around: 1) Navigate to user > preferences 2) Reset Table Configuration for "ImageAttachmentTable"
Author
Owner

@jeremystretch commented on GitHub (Nov 14, 2023):

  1. Select order by parent.

Ah, that was not in the original reproduction steps. @bmp521 could you please update the original post above?

@jeremystretch commented on GitHub (Nov 14, 2023): > 2. Select order by parent. Ah, that was not in the original reproduction steps. @bmp521 could you please update the original post above?
Author
Owner

@MrFoxTrot commented on GitHub (Nov 14, 2023):

  1. Select order by parent.

Ah, that was not in the original reproduction steps. @bmp521 could you please update the original post above?

That's not my post) but got same issue :>

@MrFoxTrot commented on GitHub (Nov 14, 2023): > > 2. Select order by parent. > > Ah, that was not in the original reproduction steps. @bmp521 could you please update the original post above? That's not my post) but got same issue :>
Author
Owner

@bmp521 commented on GitHub (Nov 14, 2023):

The workaround steps from @MrFoxTrot restored access to the page: Customization > Image Attachments as well as the images listed within the locations. Thank you all for your assistance.

@bmp521 commented on GitHub (Nov 14, 2023): The workaround steps from @MrFoxTrot restored access to the page: Customization > Image Attachments as well as the images listed within the locations. Thank you all for your assistance.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8831