Working v0
This commit is contained in:
+57
-44
@@ -10,12 +10,10 @@ For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/5.1/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from django.utils.module_loading import import_module
|
||||
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from django.utils.module_loading import import_module
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -24,7 +22,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-$440wv7cqb$-umfo-x%w_@p3g5kuuk1(!rv#=7*gzndx4_h4ds'
|
||||
SECRET_KEY = "django-insecure-$440wv7cqb$-umfo-x%w_@p3g5kuuk1(!rv#=7*gzndx4_h4ds"
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
@@ -35,18 +33,34 @@ ALLOWED_HOSTS = []
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
'main',
|
||||
'users',
|
||||
'items',
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django_js_reverse",
|
||||
"djangobower",
|
||||
"main",
|
||||
"users",
|
||||
"items",
|
||||
]
|
||||
|
||||
'django_js_reverse',
|
||||
BOWER_COMPONENT_ROOT = os.path.join(BASE_DIR, "components")
|
||||
BOWER_INSTALLED_APPS = [
|
||||
"https://code.jquery.com/jquery-3.7.1.min.js",
|
||||
"https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js",
|
||||
"https://cdn.jsdelivr.net/npm/sweetalert2@11",
|
||||
"https://cdn.jsdelivr.net/npm/vue-resource@1.5.3",
|
||||
"https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js",
|
||||
"https://unpkg.com/vue-router@3/dist/vue-router.js",
|
||||
"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css",
|
||||
"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js",
|
||||
"https://cdn.jsdelivr.net/npm/bootswatch@5.3.3/dist/lux/bootstrap.min.css",
|
||||
"https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css",
|
||||
"https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js",
|
||||
"https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css",
|
||||
"https://fonts.cdnfonts.com/css/jetbrains-mono",
|
||||
]
|
||||
|
||||
STATIC_URL = "/static/"
|
||||
@@ -56,7 +70,7 @@ STATICFILES_DIRS = (os.path.join(BASE_DIR, "static_source"),)
|
||||
STATICFILES_FINDERS = (
|
||||
"django.contrib.staticfiles.finders.FileSystemFinder",
|
||||
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
||||
# "djangobower.finders.BowerFinder",
|
||||
"djangobower.finders.BowerFinder",
|
||||
# "compressor.finders.CompressorFinder",
|
||||
)
|
||||
|
||||
@@ -70,37 +84,37 @@ STORAGES = {
|
||||
}
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'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.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'app.urls'
|
||||
ROOT_URLCONF = "app.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [
|
||||
os.path.join(BASE_DIR, "templates"),
|
||||
],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'app.utils.extra_context.extra_context',
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"app.utils.extra_context.extra_context",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'app.wsgi.application'
|
||||
WSGI_APPLICATION = "app.wsgi.application"
|
||||
|
||||
|
||||
# Database
|
||||
@@ -114,16 +128,16 @@ DATABASES = {}
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
||||
},
|
||||
]
|
||||
|
||||
@@ -131,9 +145,9 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/5.1/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_CODE = "en-us"
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
TIME_ZONE = "UTC"
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
@@ -142,12 +156,11 @@ USE_TZ = True
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
|
||||
from app.settingsLocal import *
|
||||
|
||||
|
||||
for extra_app in EXTRA_APPS:
|
||||
INSTALLED_APPS.append(extra_app)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ def header_for_table(model):
|
||||
|
||||
return [
|
||||
{
|
||||
"text": value,
|
||||
"value": key,
|
||||
**value,
|
||||
}
|
||||
for key, value in headers.items()
|
||||
] + [
|
||||
@@ -15,7 +15,3 @@ def header_for_table(model):
|
||||
"sortable": False,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def encrypted_fields(model):
|
||||
return model.Encryption.fields
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from django.conf import settings
|
||||
from django.apps import apps
|
||||
|
||||
|
||||
from users.models import UserSettings
|
||||
from pathlib import Path
|
||||
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
from rich import print
|
||||
from users.models import UserSettings
|
||||
|
||||
|
||||
def extra_context(request):
|
||||
|
||||
@@ -21,17 +21,16 @@ def extra_context(request):
|
||||
for path in p.iterdir():
|
||||
components.append(path.name)
|
||||
|
||||
return {
|
||||
ret = {
|
||||
"user_settings": user_settings,
|
||||
"templates": {
|
||||
component: f"components/{component}/template.html"
|
||||
for component in components
|
||||
},
|
||||
"components": {
|
||||
component: {
|
||||
"path": f"components/{component}/vue.js",
|
||||
"flat_name": component.replace("-", "_").lower(),
|
||||
}
|
||||
for component in components
|
||||
}
|
||||
component: f"components/{component}/vue.js" for component in components
|
||||
},
|
||||
}
|
||||
|
||||
print(ret)
|
||||
return ret
|
||||
|
||||
@@ -11,15 +11,44 @@ class BaseQuerySet(models.QuerySet):
|
||||
def headers(self):
|
||||
"""Return the list of header for a list."""
|
||||
|
||||
def _field(field):
|
||||
ret = {
|
||||
field.name: {
|
||||
"text": field.verbose_name.capitalize(),
|
||||
"align": "",
|
||||
"encrypted": field.name in self.model.Encryption.fields,
|
||||
"editable": field.name
|
||||
not in self.model.Serialization.excluded_fields_edit,
|
||||
"field_widget": "v-textarea",
|
||||
}
|
||||
}
|
||||
|
||||
if isinstance(field, RelatedField):
|
||||
ret[f"{field.name}__name"] = {
|
||||
"text": f"{field.verbose_name.capitalize()} - Name",
|
||||
"align": "",
|
||||
"encrypted": True,
|
||||
}
|
||||
ret[f"{field.name}__name"] = {
|
||||
"text": f"{field.verbose_name.capitalize()} - Identifier",
|
||||
"align": "",
|
||||
"encrypted": True,
|
||||
}
|
||||
|
||||
ret[field.name].update(
|
||||
align=" d-none",
|
||||
testing=123,
|
||||
field_widget="v-select",
|
||||
)
|
||||
|
||||
return ret
|
||||
|
||||
fields = {}
|
||||
for field in self.model._meta.fields:
|
||||
if field.name in self.model.Serialization.excluded_fields:
|
||||
continue
|
||||
|
||||
# if isinstance(field, RelatedField):
|
||||
# fields[f"{field.name}__name"] = field.verbose_name.capitalize()
|
||||
|
||||
fields[field.name] = field.verbose_name.capitalize()
|
||||
fields.update(_field(field))
|
||||
|
||||
return fields
|
||||
|
||||
|
||||
Reference in New Issue
Block a user