Skip to content

Commit

Permalink
Use BigAutoField for djedi.backends.django.db.models.Node
Browse files Browse the repository at this point in the history
  • Loading branch information
jocke-l committed Oct 11, 2023
1 parent 857fe5f commit 9351de0
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 46 deletions.
1 change: 1 addition & 0 deletions djedi/backends/django/db/models.py
Expand Up @@ -2,6 +2,7 @@


class Node(models.Model):
id = models.BigAutoField(primary_key=True)

key = models.CharField(max_length=255, db_index=True)
content = models.TextField(blank=True)
Expand Down
19 changes: 19 additions & 0 deletions djedi/migrations/0003_alter_node_id.py
@@ -0,0 +1,19 @@
# Generated by Django 4.2.6 on 2023-10-11 10:19

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("djedi", "0002_auto_20190722_1447"),
]

operations = [
migrations.AlterField(
model_name="node",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]
92 changes: 46 additions & 46 deletions example/example/settings.py
Expand Up @@ -16,72 +16,74 @@
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'jf_&sn#&5gb7n510ji#9m7^@@-w@g%f(j0y=@=)pmvpc@4ia0)'
SECRET_KEY = "jf_&sn#&5gb7n510ji#9m7^@@-w@g%f(j0y=@=)pmvpc@4ia0)"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS = ["*"]


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'djedi',
'example',
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"corsheaders",
"djedi",
"example",
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'djedi.middleware.translation.DjediTranslationMiddleware',
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"corsheaders.middleware.CorsMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"djedi.middleware.translation.DjediTranslationMiddleware",
]

ROOT_URLCONF = 'example.urls'
ROOT_URLCONF = "example.urls"

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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',
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"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",
],
},
},
]

WSGI_APPLICATION = 'example.wsgi.application'
WSGI_APPLICATION = "example.wsgi.application"


# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}

Expand All @@ -95,9 +97,9 @@
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/

LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"

TIME_ZONE = 'UTC'
TIME_ZONE = "UTC"

USE_I18N = True

Expand All @@ -109,31 +111,29 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/

STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_URL = "/static/"
MEDIA_URL = "/media/"

STATIC_ROOT = '/static/'
MEDIA_ROOT = '/media/'
STATIC_ROOT = "/static/"
MEDIA_ROOT = "/media/"

# To test if collectstatic with ManifestStaticFilesStorage works, set `DEBUG =
# False` and run:
# docker-compose exec django python manage.py collectstatic --no-input
# DEBUG = False
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"

# CORS
# https://github.com/OttoYiu/django-cors-headers

CORS_ORIGIN_WHITELIST = (
'localhost:3000',
)
CORS_ORIGIN_WHITELIST = ("localhost:3000",)

CORS_ALLOW_CREDENTIALS = True

# Djedi
# https://djedi-cms.org/settings.html

DJEDI_XSS_DOMAIN = 'localhost'
DJEDI_XSS_DOMAIN = "localhost"

# env DJEDI_THEME=luke docker-compose up -d django
DJEDI_THEME = os.environ.get('DJEDI_THEME') or None
DJEDI_THEME = os.environ.get("DJEDI_THEME") or None

0 comments on commit 9351de0

Please sign in to comment.