Refactored file structure to fix docker build, fixed Unfold configuration.
@@ -40,7 +40,7 @@ RUN pip install --upgrade pip \
|
|||||||
# 4. Collect static assets
|
# 4. Collect static assets
|
||||||
# =============================================
|
# =============================================
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY ./app .
|
||||||
|
|
||||||
RUN python manage.py collectstatic --noinput
|
RUN python manage.py collectstatic --noinput
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,15 @@ class UserAdmin(BaseUserAdmin, ModelAdmin):
|
|||||||
form = UserChangeForm
|
form = UserChangeForm
|
||||||
add_form = UserCreationForm
|
add_form = UserCreationForm
|
||||||
change_password_form = AdminPasswordChangeForm
|
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)
|
@admin.register(Group)
|
||||||
@@ -2,6 +2,9 @@ import os
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
from django.urls import reverse_lazy
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||||
@@ -21,6 +24,8 @@ CSRF_COOKIE_SECURE = True
|
|||||||
SESSION_COOKIE_SECURE = True
|
SESSION_COOKIE_SECURE = True
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
"unfold", # Admin UI
|
||||||
|
"unfold.contrib.filters",
|
||||||
"django.contrib.admin",
|
"django.contrib.admin",
|
||||||
"django.contrib.auth",
|
"django.contrib.auth",
|
||||||
"django.contrib.contenttypes",
|
"django.contrib.contenttypes",
|
||||||
@@ -31,8 +36,6 @@ INSTALLED_APPS = [
|
|||||||
"apps.core",
|
"apps.core",
|
||||||
"apps.dashboard",
|
"apps.dashboard",
|
||||||
"ninja", # Django Ninja API
|
"ninja", # Django Ninja API
|
||||||
"unfold", # Admin UI
|
|
||||||
"unfold.contrib.filters",
|
|
||||||
"mozilla_django_oidc", # OIDC Client
|
"mozilla_django_oidc", # OIDC Client
|
||||||
"tailwind",
|
"tailwind",
|
||||||
"theme"
|
"theme"
|
||||||
@@ -113,6 +116,8 @@ UNFOLD = {
|
|||||||
"LOGIN_REDIRECT_URL": "/admin/",
|
"LOGIN_REDIRECT_URL": "/admin/",
|
||||||
"ENVIRONMENT": "Keywarden",
|
"ENVIRONMENT": "Keywarden",
|
||||||
"ENVIRONMENT_COLOR": "#7C3AED",
|
"ENVIRONMENT_COLOR": "#7C3AED",
|
||||||
|
"SHOW_VIEW_ON_SITE": True,
|
||||||
|
"THEME": "dark", # Force theme: "dark" or "light". Will disable theme switcher
|
||||||
"SIDEBAR": {
|
"SIDEBAR": {
|
||||||
"show_search": True,
|
"show_search": True,
|
||||||
"show_all_applications": True,
|
"show_all_applications": True,
|
||||||
@@ -138,6 +143,31 @@ UNFOLD = {
|
|||||||
"/static/unfold/js/simplebar.js",
|
"/static/unfold/js/simplebar.js",
|
||||||
"/static/unfold/js/alpine.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")
|
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/"
|
LOGIN_URL = "/oidc/authenticate/"
|
||||||
LOGOUT_URL = "/oidc/logout/"
|
LOGOUT_URL = "/oidc/logout/"
|
||||||
LOGIN_REDIRECT_URL = "/"
|
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 |