netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.97k stars 2.56k forks source link

FieldError at /users/permissions/ - Cannot resolve keyword 'can_view' into field. Choices are: actions, constraints, description, enabled, groups, id, name, object_types, users #14888

Closed pierro78 closed 7 months ago

pierro78 commented 8 months ago

Deployment Type

Self-hosted

NetBox Version

v3.7.1

Python Version

3.8

Steps to Reproduce

1 click on Admin and then "permissions"

(some notes : we are on netbox-docker. we have a couple of permissions defined and then we must have modified a permission or sthg and we now have this issue - we were on 3.6.6 and I've just upgraded to 3.7.1 : same issue)

Expected Behavior

the list of permissions shoud be displayed

Observed Behavior

a python exception is raised :

Environment:

Request Method: GET Request URL: http://x.y.z.t:8000/users/permissions/

Django Version: 4.2.9 Python Version: 3.11.4 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.forms', 'corsheaders', 'debug_toolbar', 'graphiql_debug_toolbar', 'django_filters', 'django_tables2', 'django_prometheus', 'graphene_django', 'mptt', 'rest_framework', 'social_django', 'taggit', 'timezone_field', 'core', 'account', 'circuits', 'dcim', 'ipam', 'extras', 'tenancy', 'users', 'utilities', 'virtualization', 'vpn', 'wireless', 'django_rq', 'drf_spectacular', 'drf_spectacular_sidecar', 'netbox_attachments.NetBoxAttachmentsConfig'] Installed Middleware: ['graphiql_debug_toolbar.middleware.DebugToolbarMiddleware', 'django_prometheus.middleware.PrometheusBeforeMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'netbox.middleware.RemoteUserMiddleware', 'netbox.middleware.CoreMiddleware', 'netbox.middleware.MaintenanceModeMiddleware', 'django_prometheus.middleware.PrometheusAfterMiddleware']

Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view return self.dispatch(request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/views/generic/base.py", line 77, in dispatch return super().dispatch(request, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/utilities/views.py", line 99, in dispatch return super().dispatch(request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch return handler(request, args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/views/generic/bulk_views.py", line 162, in get table = self.get_table(self.queryset, request, has_bulk_actions) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/views/generic/mixins.py", line 82, in get_table table.configure(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/tables/tables.py", line 160, in configure self.order_by = ordering ^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django_tables2/tables.py", line 542, in order_by self.data.order_by(self._order_by) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django_tables2/data.py", line 224, in order_by self.data = self.data.order_by(order_by_accessors) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1659, in order_by obj.query.add_ordering(*field_names) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 2222, in add_ordering self.names_to_path(item.split(LOOKUP_SEP), self.model._meta) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1725, in names_to_path raise FieldError( ^

Exception Type: FieldError at /users/permissions/ Exception Value: Cannot resolve keyword 'can_view' into field. Choices are: actions, constraints, description, enabled, groups, id, name, object_types, users

abhi1693 commented 8 months ago

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.7.1. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

pierro78 commented 8 months ago

thanks I am going to try to get the steps to reproduce ...

... I am not sure if that can help but I can access and do what I want on the permissions if I type their URLs, for example http://x.y.z.t:8000/users/permissions/3/

jeremystretch commented 7 months ago

This issue is being closed as no further information has been provided. If you would like to revisit this topic, please first modify your original post to include all the requested detail, and then ask that the issue be reopened.