Closed bmp521 closed 10 months ago
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
Got same error when set sort on ImageAttachmentsTable by this field
I'm not able to load the Image Attachment page and the location/rack page does not show the pictures.
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.
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"
- Select order by parent.
Ah, that was not in the original reproduction steps. @bmp521 could you please update the original post above?
- 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 :>
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.
Please see Discussion #14115
NetBox version
3.6.4
Python version
3.10
Steps to Reproduce
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: