Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ipython_config.py
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
Expand Down
149 changes: 76 additions & 73 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,81 +1,84 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.12
python: python3.12
default_stages: [pre-commit, pre-push]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-toml
- id: check-xml
- id: check-yaml
- id: check-added-large-files
- id: detect-aws-credentials
args:
- --allow-missing-credentials
- id: end-of-file-fixer
- id: mixed-line-ending
- id: pretty-format-json
args:
- --autofix
- id: trailing-whitespace
exclude_types:
- javascript
- markdown
- repo: https://github.com/PyCQA/flake8
rev: 7.2.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-noqa
args:
- --max-line-length=120
- --max-complexity=18
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3.12
args:
- --line-length=120
- repo: https://github.com/PyCQA/bandit
rev: '1.8.3'
hooks:
- id: bandit
- repo: https://github.com/PyCQA/isort
rev: '6.0.1'
hooks:
- id: isort
- repo: https://github.com/dosisod/refurb
rev: v2.0.0
hooks:
- id: refurb
additional_dependencies:
- boto3
- django-constance
- django-cors-headers
- django-environ
- django-extensions
- django-filter
- django-simple-history
- django-stubs[compatible-mypy]
- drf-spectacular
- drf-standardized-errors
- djangorestframework-stubs[compatible-mypy]
- zappa-django-utils
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.6.12
hooks:
- id: uv-lock
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.4
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-toml
- id: check-xml
- id: check-yaml
- id: check-added-large-files
- id: detect-aws-credentials
args:
- --allow-missing-credentials
- id: end-of-file-fixer
- id: mixed-line-ending
- id: pretty-format-json
args:
- --autofix
- id: trailing-whitespace
exclude_types:
- javascript
- markdown
- repo: https://github.com/PyCQA/flake8
rev: 7.2.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-noqa
args:
- --max-line-length=120
- --max-complexity=18
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3.12
args:
- --line-length=120
- repo: https://github.com/PyCQA/bandit
rev: "1.8.3"
hooks:
- id: bandit
args:
- -c
- bandit.yaml
- repo: https://github.com/PyCQA/isort
rev: "6.0.1"
hooks:
- id: isort
- repo: https://github.com/dosisod/refurb
rev: v2.0.0
hooks:
- id: refurb
additional_dependencies:
- boto3
- django-constance
- django-cors-headers
- django-environ
- django-extensions
- django-filter
- django-simple-history
- django-stubs[compatible-mypy]
- drf-spectacular
- drf-standardized-errors
- djangorestframework-stubs[compatible-mypy]
- zappa-django-utils
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.6.12
hooks:
- id: uv-lock
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.4
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: 'v1.15.0'
# hooks:
Expand Down
12 changes: 12 additions & 0 deletions app/cms/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import importlib

from django.apps import AppConfig


class CmsConfig(AppConfig):
name = "cms"

def ready(self):
importlib.import_module("cms.translation")

from cms.models import Page, Section, Sitemap
from simple_history import register

register(Page)
register(Sitemap)
register(Section)
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
# Generated by Django 5.2 on 2025-04-21 13:38

import uuid

import django.db.models.deletion
import simple_history.models
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("cms", "0001_initial"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name="HistoricalPage",
fields=[
(
"id",
models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
),
("is_active", models.BooleanField(default=False)),
("css", models.TextField(blank=True, default=None, null=True)),
("title", models.CharField(max_length=256)),
("title_ko", models.CharField(max_length=256, null=True)),
("title_en", models.CharField(max_length=256, null=True)),
("subtitle", models.CharField(max_length=512)),
("subtitle_ko", models.CharField(max_length=512, null=True)),
("subtitle_en", models.CharField(max_length=512, null=True)),
("history_id", models.AutoField(primary_key=True, serialize=False)),
("history_date", models.DateTimeField(db_index=True)),
("history_change_reason", models.CharField(max_length=100, null=True)),
(
"history_type",
models.CharField(
choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
max_length=1,
),
),
(
"history_user",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"verbose_name": "historical page",
"verbose_name_plural": "historical pages",
"ordering": ("-history_date", "-history_id"),
"get_latest_by": ("history_date", "history_id"),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
migrations.CreateModel(
name="HistoricalSection",
fields=[
(
"id",
models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
),
("order", models.IntegerField(default=0)),
("css", models.TextField(blank=True, default=None, null=True)),
(
"body",
models.TextField(help_text="Content of the page, Written in markdown format"),
),
(
"body_ko",
models.TextField(
help_text="Content of the page, Written in markdown format",
null=True,
),
),
(
"body_en",
models.TextField(
help_text="Content of the page, Written in markdown format",
null=True,
),
),
("history_id", models.AutoField(primary_key=True, serialize=False)),
("history_date", models.DateTimeField(db_index=True)),
("history_change_reason", models.CharField(max_length=100, null=True)),
(
"history_type",
models.CharField(
choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
max_length=1,
),
),
(
"history_user",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
(
"page",
models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="cms.page",
),
),
],
options={
"verbose_name": "historical section",
"verbose_name_plural": "historical sections",
"ordering": ("-history_date", "-history_id"),
"get_latest_by": ("history_date", "history_id"),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
migrations.CreateModel(
name="HistoricalSitemap",
fields=[
(
"id",
models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
),
("name", models.CharField(max_length=256)),
("name_ko", models.CharField(max_length=256, null=True)),
("name_en", models.CharField(max_length=256, null=True)),
("order", models.IntegerField(default=0)),
("display_start_at", models.DateTimeField(blank=True, null=True)),
("display_end_at", models.DateTimeField(blank=True, null=True)),
("history_id", models.AutoField(primary_key=True, serialize=False)),
("history_date", models.DateTimeField(db_index=True)),
("history_change_reason", models.CharField(max_length=100, null=True)),
(
"history_type",
models.CharField(
choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
max_length=1,
),
),
(
"history_user",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
(
"page",
models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="cms.page",
),
),
(
"parent_sitemap",
models.ForeignKey(
blank=True,
db_constraint=False,
default=None,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="cms.sitemap",
),
),
],
options={
"verbose_name": "historical sitemap",
"verbose_name_plural": "historical sitemaps",
"ordering": ("-history_date", "-history_id"),
"get_latest_by": ("history_date", "history_id"),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
]
Loading