Repository: pulp/pulpcore

Issue:
Remove the django admin UI served at `/admin/`.
## Background + Proposal

We enabled the django admin as tech-preview so that we could view and modify permissions and group membership, back before we had APIs for all of these things. Now that we have APIs for all of this, we should discontinue the use of the django admin UI.

## Why?

Pulp's data is highly relational and having users interact directly with the database via forms is not a safe situation.

## Details

Removing it would involve removing these parts roughly:
* The [admin.py](https://github.com/pulp/pulpcore/blob/fcb355c1f8fec6780524c010cf5bba7e1aa1d51b/pulpcore/app/admin.py)
* The [settings.py](https://github.com/pulp/pulpcore/blob/fcb355c1f8fec6780524c010cf5bba7e1aa1d51b/pulpcore/app/settings.py#L67) and [the setting](https://github.com/pulp/pulpcore/blob/main/pulpcore/app/settings.py#L40).
* The [urls.py usage](https://github.com/pulp/pulpcore/blob/fcb355c1f8fec6780524c010cf5bba7e1aa1d51b/pulpcore/app/urls.py#L144)
* The [docs](https://github.com/pulp/pulpcore/blob/901499a3566a940516664ae6ca042455efee0115/docs/configuration/settings.rst#admin_site_url).


Discussion:

Resolving patch:
diff --git a/pulpcore/app/admin.py b/pulpcore/app/admin.py
deleted file mode 100644
--- a/pulpcore/app/admin.py
+++ /dev/null
@@ -1,56 +0,0 @@
-from django.contrib import admin
-from guardian.admin import GuardedModelAdmin
-
-from pulpcore.app.models import Task, RBACContentGuard
-
-
-@admin.register(Task)
-class TaskAdmin(GuardedModelAdmin):
-    list_display = (
-        "pulp_id",
-        "pulp_created",
-        "pulp_last_updated",
-        "state",
-        "name",
-        "started_at",
-        "finished_at",
-        "error",
-        "worker",
-        "parent_task",
-        "task_group",
-    )
-    list_filter = (
-        "pulp_created",
-        "pulp_last_updated",
-        "started_at",
-        "finished_at",
-    )
-    raw_id_fields = ("worker",)
-    search_fields = ("name",)
-    readonly_fields = (
-        "pulp_id",
-        "pulp_created",
-        "pulp_last_updated",
-        "state",
-        "name",
-        "started_at",
-        "finished_at",
-        "error",
-        "worker",
-        "parent_task",
-        "task_group",
-    )
-
-
-@admin.register(RBACContentGuard)
-class RBACContentGuardAdmin(GuardedModelAdmin):
-    list_display = (
-        "name",
-        "description",
-    )
-    list_filter = (
-        "name",
-        "pulp_created",
-        "pulp_last_updated",
-    )
-    search_fields = ("name",)
diff --git a/pulpcore/app/settings.py b/pulpcore/app/settings.py
--- a/pulpcore/app/settings.py
+++ b/pulpcore/app/settings.py
@@ -37,8 +37,6 @@
 DEPLOY_ROOT = Path("/var/lib/pulp")
 MEDIA_ROOT = str(DEPLOY_ROOT / "media")  # Django 3.1 adds support for pathlib.Path
 
-ADMIN_SITE_URL = "admin/"
-
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/1.11/howto/static-files/
 
@@ -67,7 +65,6 @@
 
 INSTALLED_APPS = [
     # django stuff
-    "django.contrib.admin",
     "django.contrib.auth",
     "django.contrib.contenttypes",
     "django.contrib.sessions",
diff --git a/pulpcore/app/urls.py b/pulpcore/app/urls.py
--- a/pulpcore/app/urls.py
+++ b/pulpcore/app/urls.py
@@ -2,7 +2,6 @@
 import logging
 
 from django.conf import settings
-from django.contrib import admin
 from django.urls import path, include
 from drf_spectacular.views import (
     SpectacularJSONAPIView,
@@ -143,7 +142,6 @@ def __repr__(self):
         PulpImporterImportCheckView.as_view(),
     ),
     path("auth/", include("rest_framework.urls")),
-    path(settings.ADMIN_SITE_URL, admin.site.urls),
 ]
 
 urlpatterns.append(


Test patch: