diff --git a/docs/configuration/miscellaneous.md b/docs/configuration/miscellaneous.md index 124de3037fb..576eb8739d3 100644 --- a/docs/configuration/miscellaneous.md +++ b/docs/configuration/miscellaneous.md @@ -96,14 +96,6 @@ The maximum size (in bytes) of an incoming HTTP request (i.e. `GET` or `POST` da --- -## DJANGO_ADMIN_ENABLED - -Default: False - -Setting this to True installs the `django.contrib.admin` app and enables the [Django admin UI](https://docs.djangoproject.com/en/5.0/ref/contrib/admin/). This may be necessary to support older plugins which do not integrate with the native NetBox interface. - ---- - ## ENFORCE_GLOBAL_UNIQUE !!! tip "Dynamic Configuration Parameter" diff --git a/netbox/netbox/admin.py b/netbox/netbox/admin.py deleted file mode 100644 index cdfacc1418a..00000000000 --- a/netbox/netbox/admin.py +++ /dev/null @@ -1,14 +0,0 @@ -from django.conf import settings -from django.contrib.admin import site as admin_site -from taggit.models import Tag - - -# Override default AdminSite attributes so we can avoid creating and -# registering our own class -admin_site.site_header = 'NetBox Administration' -admin_site.site_title = 'NetBox' -admin_site.site_url = '/{}'.format(settings.BASE_PATH) -admin_site.index_template = 'admin/index.html' - -# Unregister the unused stock Tag model provided by django-taggit -admin_site.unregister(Tag) diff --git a/netbox/netbox/configuration_testing.py b/netbox/netbox/configuration_testing.py index 346cd89d20f..cec05cabbf6 100644 --- a/netbox/netbox/configuration_testing.py +++ b/netbox/netbox/configuration_testing.py @@ -39,8 +39,6 @@ SECRET_KEY = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' -DJANGO_ADMIN_ENABLED = True - DEFAULT_PERMISSIONS = {} LOGGING = { diff --git a/netbox/netbox/plugins/urls.py b/netbox/netbox/plugins/urls.py index 075bda81182..7a9f30c7eff 100644 --- a/netbox/netbox/plugins/urls.py +++ b/netbox/netbox/plugins/urls.py @@ -3,13 +3,11 @@ from django.apps import apps from django.conf import settings from django.conf.urls import include -from django.contrib.admin.views.decorators import staff_member_required from django.urls import path from django.utils.module_loading import import_string, module_has_submodule from . import views -# Initialize URL base, API, and admin URL patterns for plugins plugin_patterns = [] plugin_api_patterns = [ path('', views.PluginsAPIRootView.as_view(), name='api-root'), diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 358f41ff883..206a58cffd0 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -110,7 +110,6 @@ 'users.delete_token': ({'user': '$user'},), }) DEVELOPER = getattr(configuration, 'DEVELOPER', False) -DJANGO_ADMIN_ENABLED = getattr(configuration, 'DJANGO_ADMIN_ENABLED', False) DOCS_ROOT = getattr(configuration, 'DOCS_ROOT', os.path.join(os.path.dirname(BASE_DIR), 'docs')) EMAIL = getattr(configuration, 'EMAIL', {}) EVENTS_PIPELINE = getattr(configuration, 'EVENTS_PIPELINE', ( @@ -373,7 +372,6 @@ def _setting(name, default=None): # INSTALLED_APPS = [ - 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', @@ -411,8 +409,6 @@ def _setting(name, default=None): ] if not DEBUG: INSTALLED_APPS.remove('debug_toolbar') -if not DJANGO_ADMIN_ENABLED: - INSTALLED_APPS.remove('django.contrib.admin') # Middleware MIDDLEWARE = [ @@ -549,7 +545,6 @@ def _setting(name, default=None): # All URLs starting with a string listed here are exempt from maintenance mode enforcement MAINTENANCE_EXEMPT_PATHS = ( - f'/{BASE_PATH}admin/', f'/{BASE_PATH}extras/config-revisions/', # Allow modifying the configuration LOGIN_URL, LOGIN_REDIRECT_URL, diff --git a/netbox/netbox/tests/dummy_plugin/admin.py b/netbox/netbox/tests/dummy_plugin/admin.py deleted file mode 100644 index 83bc22ad8f5..00000000000 --- a/netbox/netbox/tests/dummy_plugin/admin.py +++ /dev/null @@ -1,9 +0,0 @@ -from django.contrib import admin - -from netbox.admin import admin_site -from .models import DummyModel - - -@admin.register(DummyModel, site=admin_site) -class DummyModelAdmin(admin.ModelAdmin): - list_display = ('name', 'number') diff --git a/netbox/netbox/tests/test_plugins.py b/netbox/netbox/tests/test_plugins.py index 351fef9e2db..ba44378c5ce 100644 --- a/netbox/netbox/tests/test_plugins.py +++ b/netbox/netbox/tests/test_plugins.py @@ -36,12 +36,6 @@ def test_models(self): instance.delete() self.assertIsNone(instance.pk) - def test_admin(self): - - # Test admin view URL resolution - url = reverse('admin:dummy_plugin_dummymodel_add') - self.assertEqual(url, '/admin/dummy_plugin/dummymodel/add/') - @override_settings(LOGIN_REQUIRED=False) def test_views(self): diff --git a/netbox/netbox/urls.py b/netbox/netbox/urls.py index b0175ec043d..08c9a46a82a 100644 --- a/netbox/netbox/urls.py +++ b/netbox/netbox/urls.py @@ -77,11 +77,6 @@ path('api/plugins/', include((plugin_api_patterns, 'plugins-api'))), ] -# Django admin UI -if settings.DJANGO_ADMIN_ENABLED: - from .admin import admin_site - _patterns.append(path('admin/', admin_site.urls)) - # django-debug-toolbar if settings.DEBUG: import debug_toolbar diff --git a/netbox/templates/inc/user_menu.html b/netbox/templates/inc/user_menu.html index 1b675741624..e27be3323cd 100644 --- a/netbox/templates/inc/user_menu.html +++ b/netbox/templates/inc/user_menu.html @@ -36,11 +36,6 @@