Refactored file structure to fix docker build, fixed Unfold configuration.
@@ -40,7 +40,7 @@ RUN pip install --upgrade pip \
|
||||
# 4. Collect static assets
|
||||
# =============================================
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
COPY ./app .
|
||||
|
||||
RUN python manage.py collectstatic --noinput
|
||||
|
||||
|
||||
@@ -22,6 +22,15 @@ class UserAdmin(BaseUserAdmin, ModelAdmin):
|
||||
form = UserChangeForm
|
||||
add_form = UserCreationForm
|
||||
change_password_form = AdminPasswordChangeForm
|
||||
|
||||
# Set to False, to enable filter as "sidebar"
|
||||
list_filter_sheet = True
|
||||
|
||||
# Display fields in changeform in compressed mode
|
||||
compressed_fields = True # Default: False
|
||||
|
||||
# Warn before leaving unsaved changes in changeform
|
||||
warn_unsaved_form = True # Default: False
|
||||
|
||||
|
||||
@admin.register(Group)
|
||||
@@ -2,6 +2,9 @@ import os
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
load_dotenv()
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
@@ -21,6 +24,8 @@ CSRF_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"unfold", # Admin UI
|
||||
"unfold.contrib.filters",
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
@@ -31,8 +36,6 @@ INSTALLED_APPS = [
|
||||
"apps.core",
|
||||
"apps.dashboard",
|
||||
"ninja", # Django Ninja API
|
||||
"unfold", # Admin UI
|
||||
"unfold.contrib.filters",
|
||||
"mozilla_django_oidc", # OIDC Client
|
||||
"tailwind",
|
||||
"theme"
|
||||
@@ -113,6 +116,8 @@ UNFOLD = {
|
||||
"LOGIN_REDIRECT_URL": "/admin/",
|
||||
"ENVIRONMENT": "Keywarden",
|
||||
"ENVIRONMENT_COLOR": "#7C3AED",
|
||||
"SHOW_VIEW_ON_SITE": True,
|
||||
"THEME": "dark", # Force theme: "dark" or "light". Will disable theme switcher
|
||||
"SIDEBAR": {
|
||||
"show_search": True,
|
||||
"show_all_applications": True,
|
||||
@@ -138,6 +143,31 @@ UNFOLD = {
|
||||
"/static/unfold/js/simplebar.js",
|
||||
"/static/unfold/js/alpine.js",
|
||||
],
|
||||
"SITE_DROPDOWN": [
|
||||
{
|
||||
"icon": "diamond",
|
||||
"title": _("Keywarden"),
|
||||
"link": "https://keywarden.dev.ntbx.io",
|
||||
"attrs": {
|
||||
"target": "_blank",
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
# "TABS": [
|
||||
# {
|
||||
# "models": [
|
||||
# "app_label.Accounts",
|
||||
# ],
|
||||
# "items": [
|
||||
# {
|
||||
# "title": _("Accounts"),
|
||||
# "link": reverse_lazy("admin:app_label_model_name_changelist"),
|
||||
# "permission": "keywarden.settings.permission_callback",
|
||||
# },
|
||||
# ],
|
||||
# },
|
||||
# ],
|
||||
}
|
||||
|
||||
OIDC_RP_CLIENT_ID = os.getenv("KEYWARDEN_OIDC_CLIENT_ID")
|
||||
@@ -150,4 +180,7 @@ OIDC_OP_JWKS_ENDPOINT = os.getenv("KEYWARDEN_OIDC_JWKS_ENDPOINT")
|
||||
LOGIN_URL = "/oidc/authenticate/"
|
||||
LOGOUT_URL = "/oidc/logout/"
|
||||
LOGIN_REDIRECT_URL = "/"
|
||||
LOGOUT_REDIRECT_URL = "/"
|
||||
LOGOUT_REDIRECT_URL = "/"
|
||||
|
||||
def permission_callback(request):
|
||||
return request.user.has_perm("keywarden.change_model")
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 504 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 380 B |
|
Before Width: | Height: | Size: 677 B After Width: | Height: | Size: 677 B |
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 392 B |
|
Before Width: | Height: | Size: 784 B After Width: | Height: | Size: 784 B |
|
Before Width: | Height: | Size: 560 B After Width: | Height: | Size: 560 B |
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 581 B |
|
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 436 B |
|
Before Width: | Height: | Size: 560 B After Width: | Height: | Size: 560 B |
|
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |