Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BigAutoField #120

Merged
merged 10 commits into from Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: "3.12"
jocke-l marked this conversation as resolved.
Show resolved Hide resolved
- uses: pre-commit/action@v2.0.3

tests:
Expand All @@ -25,11 +25,11 @@ jobs:
max-parallel: 5
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
# - "3.12" # Enable when we get rid of setuptools

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
python-version: "3.12"
jocke-l marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/download-artifact@v3
with:
name: coverage-files
Expand Down
26 changes: 13 additions & 13 deletions .pre-commit-config.yaml
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3.10
jocke-l marked this conversation as resolved.
Show resolved Hide resolved
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
Expand All @@ -11,42 +11,42 @@ repos:
- id: debug-statements
- id: detect-private-key
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- --py36-plus
- repo: https://github.com/myint/autoflake
rev: v1.4
- --py38-plus
- repo: https://github.com/pycqa/autoflake
rev: v2.2.1
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- --ignore-init-module-imports
- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
additional_dependencies: [black==23.9.1]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-tidy-imports
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.11.0
rev: 0.27.0
hooks:
- id: check-github-workflows
# - repo: https://github.com/mgedmin/check-manifest
Expand Down
1 change: 0 additions & 1 deletion djedi/admin/cms.py
Expand Up @@ -10,7 +10,6 @@


class Admin(ModelAdmin):

verbose_name = "CMS"
verbose_name_plural = verbose_name

Expand Down
7 changes: 7 additions & 0 deletions djedi/apps.py
@@ -0,0 +1,7 @@
from django.apps import AppConfig


class DjediConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "djedi"
verbose_name = "Djedi CMS"
2 changes: 0 additions & 2 deletions djedi/backends/django/db/backend.py
Expand Up @@ -12,7 +12,6 @@


class DjangoModelStorageBackend(DatabaseBackend):

scheme = "db"

def __init__(self, **config):
Expand All @@ -32,7 +31,6 @@ def get_many(self, uris):

# Assert requested plugin matches
if uri.ext in (None, plugin):

# Assert version matches or node is published
if (uri.version == version) or (is_published and not uri.version):
meta = self._decode_meta(meta, is_published=is_published)
Expand Down
2 changes: 0 additions & 2 deletions djedi/backends/django/db/models.py
Expand Up @@ -2,7 +2,6 @@


class Node(models.Model):

key = models.CharField(max_length=255, db_index=True)
content = models.TextField(blank=True)
plugin = models.CharField(max_length=8)
Expand All @@ -12,5 +11,4 @@ class Node(models.Model):
date_created = models.DateTimeField(auto_now_add=True)

class Meta:
app_label = "djedi"
db_table = "djedi_node"
1 change: 0 additions & 1 deletion djedi/migrations/0001_initial.py
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = []

operations = [
Expand Down
1 change: 0 additions & 1 deletion djedi/migrations/0002_auto_20190722_1447.py
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("djedi", "0001_initial"),
]
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
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -58,11 +58,11 @@
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
],
Expand Down