On version 0.8.2 and NetBox 4.5.4 (docker), with any values of allowed_doc_types set, Add Document on any model results in an exception. With allowed_doc_types undefined, it does not happen. This happens in a completely empty, new database.
Request URL: http://localhost:8000/plugins/documents/documents/add/?content_type=6&object_id=1&return_url=/dcim/sites/1/
Django Version: 5.2.11
Python Version: 3.12.3
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.forms',
'corsheaders',
'debug_toolbar',
'django_filters',
'django_htmx',
'django_tables2',
'django_prometheus',
'strawberry_django',
'mptt',
'rest_framework',
'social_django',
'sorl.thumbnail',
'taggit',
'timezone_field',
'core',
'account',
'circuits',
'dcim',
'ipam',
'extras',
'tenancy',
'users',
'utilities',
'virtualization',
'vpn',
'wireless',
'django_rq',
'drf_spectacular',
'drf_spectacular_sidecar',
'django3_saml2_nbplugin.Django3AuthSAML2Plugin',
'netbox_azure.AzureConfig',
'netbox_documents.NetboxDocuments',
'netbox_dns.DNSConfig',
'netbox_reorder_rack.NetboxReorderRackConfig',
'netbox_secrets.NetBoxSecrets',
'netbox_itsm.ITSMConfig']
Installed Middleware:
['strawberry_django.middlewares.debug_toolbar.DebugToolbarMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'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',
'django_htmx.middleware.HtmxMiddleware',
'netbox.middleware.RemoteUserMiddleware',
'netbox.middleware.CoreMiddleware',
'netbox.middleware.MaintenanceModeMiddleware']
Traceback (most recent call last):
File "/opt/netbox/netbox/netbox/middleware.py", line 129, in __call__
username = request.META[self.header]
^^^^^^^^^^^^^^^^^^^^^^^^^
During handling of the above exception ('HTTP_REMOTE_USER'), another exception occurred:
File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/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.12/site-packages/django/views/generic/base.py", line 105, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 193, in dispatch
return super().dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/views/generic/base.py", line 26, in dispatch
return super().dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/utilities/views.py", line 149, in dispatch
return super().dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/utilities/views.py", line 48, in dispatch
return super().dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
return handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 245, in get
form = self.form(instance=obj, initial=initial_data, prefix=form_prefix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_documents/forms.py", line 29, in __init__
all_choices = list(DocTypeChoices.choices)
^^^^^^^^^^^^^^^^^^^^^^
Exception Type: AttributeError at /plugins/documents/documents/add/
Exception Value: type object 'DocTypeChoices' has no attribute 'choices'
"netbox_documents": {
"enable_navigation_menu": False,
"documents_location": "right",
"custom_doc_types": [
("sla", "SLA Document", "teal"),
],
"allowed_doc_types": {
"__all__": ["diagram", "purchaseorder", "quote", "other"],
"circuits.provider": ["contract", "msa", "sla", "other"],
},
},
On version 0.8.2 and NetBox 4.5.4 (docker), with any values of allowed_doc_types set, Add Document on any model results in an exception. With allowed_doc_types undefined, it does not happen. This happens in a completely empty, new database.
Config: