From 5507b9cbdbf14bc0fd4c40e1cb5983997a054c7a Mon Sep 17 00:00:00 2001 From: Josh Thomas Date: Tue, 13 Feb 2024 16:54:46 -0600 Subject: [PATCH] :bookmark: bump version 2024.1 -> 2024.2 (#26) --- CHANGELOG.md | 4 + VERSION | 2 +- copier.yml | 2 +- examples/default/.copier/project.yml | 4 +- examples/default/.github/dependabot.yml | 2 +- examples/default/.github/workflows/test.yml | 1 + examples/default/.pre-commit-config.yaml | 23 ++-- examples/default/default/__init__.py | 4 +- examples/default/default/core/views.py | 20 ++- examples/default/default/settings.py | 8 +- .../default/users/migrations/0001_initial.py | 2 +- examples/default/default/users/views.py | 0 examples/default/pyproject.toml | 33 ++++- examples/default/requirements.in | 3 + examples/default/templates/404.html | 14 +- examples/default/templates/500.html | 14 +- examples/default/templates/base.html | 121 +++++++++--------- examples/default/templates/index.html | 8 +- examples/default/tests/test_version.py | 2 +- examples/with_vite/.copier/project.yml | 4 +- examples/with_vite/.github/dependabot.yml | 2 +- examples/with_vite/.github/workflows/test.yml | 1 + examples/with_vite/.pre-commit-config.yaml | 23 ++-- examples/with_vite/pyproject.toml | 33 ++++- examples/with_vite/requirements.in | 3 + examples/with_vite/templates/404.html | 14 +- examples/with_vite/templates/500.html | 30 ++--- examples/with_vite/templates/base.html | 1 - examples/with_vite/templates/index.html | 8 +- examples/with_vite/tests/test_version.py | 2 +- examples/with_vite/with_vite/__init__.py | 3 +- examples/with_vite/with_vite/core/views.py | 20 ++- examples/with_vite/with_vite/settings.py | 8 +- .../users/migrations/0001_initial.py | 2 +- examples/with_vite/with_vite/users/views.py | 0 pyproject.toml | 2 +- src/django_twc_project/templates/404.html | 28 ++-- src/django_twc_project/templates/index.html | 8 +- tests/test_version.py | 4 +- 39 files changed, 275 insertions(+), 188 deletions(-) delete mode 100644 examples/default/default/users/views.py delete mode 100644 examples/with_vite/with_vite/users/views.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e195bd73..b70e2fcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] + +## [2024.2] + ### Added - Minimum Copier version set to 9.1.0. @@ -75,3 +78,4 @@ Initial release! 🎉 [unreleased]: https://github.com/westerveltco/django-twc-project/compare/v2024.1...HEAD [2024.1]: https://github.com/westerveltco/django-simple-nav/releases/tag/v2024.1 +[2024.2]: https://github.com/westerveltco/django-twc-project.git/releases/tag/v2024.2 diff --git a/VERSION b/VERSION index 702b928a..725ee738 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2024.1 +2024.2 diff --git a/copier.yml b/copier.yml index e4f189d5..073d8822 100644 --- a/copier.yml +++ b/copier.yml @@ -9,7 +9,7 @@ _secret_questions: _subdirectory: src/django_twc_project template_version: - default: "2024.1" + default: "2024.2" when: false # ---------------------------------------------------------------------- diff --git a/examples/default/.copier/project.yml b/examples/default/.copier/project.yml index 1a1caff2..b37eb4cc 100644 --- a/examples/default/.copier/project.yml +++ b/examples/default/.copier/project.yml @@ -1,9 +1,9 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 5f7d998 +_commit: v2024.1-32-g21072fe _src_path: . admin_email: admin@example.com author_name: John Doe -current_version: 2024-2-1 +current_version: 2024.2.1 default_from_email: johndoe@example.com django_version: '4.2' domain_name: default.westervelt.com diff --git a/examples/default/.github/dependabot.yml b/examples/default/.github/dependabot.yml index b956a212..4130c916 100644 --- a/examples/default/.github/dependabot.yml +++ b/examples/default/.github/dependabot.yml @@ -23,7 +23,7 @@ updates: patterns: - "*" exclude-patterns: - - "django-email-relay" + - "django-email-relay" - package-ecosystem: npm directory: "/" schedule: diff --git a/examples/default/.github/workflows/test.yml b/examples/default/.github/workflows/test.yml index 0deb03ed..6e94c75a 100644 --- a/examples/default/.github/workflows/test.yml +++ b/examples/default/.github/workflows/test.yml @@ -88,6 +88,7 @@ jobs: - name: Build staticfiles run: | + python manage.py tailwind build python manage.py collectstatic # https://hynek.me/articles/ditch-codecov-python/ diff --git a/examples/default/.pre-commit-config.yaml b/examples/default/.pre-commit-config.yaml index 3035326b..00b1923d 100644 --- a/examples/default/.pre-commit-config.yaml +++ b/examples/default/.pre-commit-config.yaml @@ -11,20 +11,20 @@ repos: - id: check-yaml - repo: https://github.com/adamchainz/django-upgrade - rev: 1.15.0 + rev: 1.16.0 hooks: - id: django-upgrade args: [--target-version, "4.2"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + rev: v0.2.1 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/adamchainz/blacken-docs - rev: "1.16.0" + rev: 1.16.0 hooks: - id: blacken-docs alias: autoformat @@ -32,7 +32,7 @@ repos: - black==22.12.0 - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v4.0.0-alpha.8 hooks: - id: prettier # lint the following with prettier: @@ -44,12 +44,11 @@ repos: # ignore any minified code files: '^(?!.*\.min\..*)(?P[\w-]+(\.[\w-]+)*\.(js|jsx|ts|tsx|yml|yaml|css))$' - - repo: https://github.com/rtts/djhtml - rev: "3.0.6" + - repo: https://github.com/djlint/djLint + rev: v1.34.1 hooks: - - id: djhtml - entry: djhtml --tabwidth 2 - alias: autoformat + - id: djlint-reformat-django + - id: djlint-django - repo: local hooks: @@ -57,18 +56,18 @@ repos: name: rustywind Tailwind CSS class linter language: node additional_dependencies: - - rustywind@0.16.0 + - rustywind@0.21.0 entry: rustywind args: [--write] types_or: [html, jsx, tsx] - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.11.0 + rev: v2.12.0 hooks: - id: pretty-format-toml args: [--autofix] - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.15 + rev: v0.16 hooks: - id: validate-pyproject diff --git a/examples/default/default/__init__.py b/examples/default/default/__init__.py index b82ada3d..75606775 100644 --- a/examples/default/default/__init__.py +++ b/examples/default/default/__init__.py @@ -1,4 +1,4 @@ from __future__ import annotations -__version__ = "2024-2-1" -__template_version__ = "2024.1" +__version__ = "2024.2.1" +__template_version__ = "2024.2" diff --git a/examples/default/default/core/views.py b/examples/default/default/core/views.py index 0c84b33a..f90c3874 100644 --- a/examples/default/default/core/views.py +++ b/examples/default/default/core/views.py @@ -1,10 +1,14 @@ from __future__ import annotations -from django.conf import settings +from pathlib import Path + from django.contrib.auth.decorators import login_required +from django.contrib.staticfiles import finders from django.http import FileResponse from django.http import HttpRequest from django.http import HttpResponse +from django.http import HttpResponseNotFound +from django.shortcuts import redirect from django.shortcuts import render from django.utils import timezone from django.views.decorators.cache import cache_control @@ -45,10 +49,18 @@ def security_txt(request: HttpRequest) -> HttpResponse: @require_GET @cache_control(max_age=60 * 60 * 24, immutable=True, public=True) # one day -def favicon(request: HttpRequest) -> FileResponse: +def favicon(request: HttpRequest) -> HttpResponse | FileResponse: name = request.path.lstrip("/") - file = (settings.BASE_DIR / "static" / "public" / name).open("rb") - return FileResponse(file) + path = finders.find(name) + if path: + file = Path(path).open("rb") + response = FileResponse(file) + else: + if name == "favicon.ico": + response = HttpResponseNotFound() + else: + response = redirect("favicon.ico") + return response @require_GET diff --git a/examples/default/default/settings.py b/examples/default/default/settings.py index 4f3ea794..5a1b5422 100644 --- a/examples/default/default/settings.py +++ b/examples/default/default/settings.py @@ -72,7 +72,7 @@ "email_relay.db.EmailDatabaseRouter", ] -DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" +DEFAULT_AUTO_FIELD = "django.db.models.AutoField" DEFAULT_FROM_EMAIL = env( "DEFAULT_FROM_EMAIL", @@ -85,11 +85,15 @@ else "email_relay.backend.RelayDatabaseEmailBackend" ) +FORM_RENDERER = "django.forms.renderers.TemplatesSetting" + INSTALLED_APPS = [ # First Party "default.core", "default.users", # Second Party + "django_q_registry", + "django_simple_nav", "django_twc_ui", "django_twc_ui.forms", "email_relay", @@ -332,7 +336,7 @@ ACCOUNT_USERNAME_REQUIRED = False -LOGIN_REDIRECT_URL = "dashboard" +LOGIN_REDIRECT_URL = "index" SOCIALACCOUNT_PROVIDERS = { "okta": { diff --git a/examples/default/default/users/migrations/0001_initial.py b/examples/default/default/users/migrations/0001_initial.py index b3014c8e..6e9d3633 100644 --- a/examples/default/default/users/migrations/0001_initial.py +++ b/examples/default/default/users/migrations/0001_initial.py @@ -19,7 +19,7 @@ class Migration(migrations.Migration): fields=[ ( "id", - models.BigAutoField( + models.AutoField( auto_created=True, primary_key=True, serialize=False, diff --git a/examples/default/default/users/views.py b/examples/default/default/users/views.py deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/default/pyproject.toml b/examples/default/pyproject.toml index 0d9a797a..78e28b11 100644 --- a/examples/default/pyproject.toml +++ b/examples/default/pyproject.toml @@ -1,20 +1,38 @@ [tool.bumpver] commit = true commit_message = ":bookmark: bump version {old_version} -> {new_version}" -current_version = "2024-2-1" +current_version = "2024.2.1" push = false # set to false for CI -tag = true +tag = false version_pattern = "YYYY.MM.INC1" [tool.bumpver.file_patterns] "default/__init__.py" = [ '__version__ = "{version}"' ] +"tests/test_version.py" = [ + 'assert __version__ == "{version}"' +] + +[tool.coverage.run] +omit = [ + "*/node_modules/*", + "default/*/migrations/*", + "default/asgi.py", + "default/wsgi.py", + "templates/*", + "tests/*", + "manage.py", + "requirements.txt" +] +plugins = ["django_coverage_plugin"] +source = ["default"] [tool.django-stubs] django_settings_module = "default.settings" [tool.djlint] +ignore = "H031" # Don't require `meta` tag keywords indent = 2 [tool.mypy] @@ -41,6 +59,8 @@ module = [ ignore_missing_imports = true module = [ "allauth.*", + "boto3.*", + "botocore.*", "debug_toolbar.*", "django_filters.*", "django_q.*", @@ -88,7 +108,6 @@ ignore = ["E501", "E741"] # temporary indent-width = 4 # Same as Black. line-length = 88 -per-file-ignores = {} select = [ "B", # flake8-bugbear "E", # Pycodestyle @@ -111,3 +130,11 @@ quote-style = "double" force-single-line = true known-first-party = ["default"] required-imports = ["from __future__ import annotations"] + +[tool.ruff.per-file-ignores] +# Tests can use magic values, assertions, and relative imports +"tests/**/*" = ["PLR2004", "S101", "TID252"] + +[tool.ruff.pyupgrade] +# Preserve types, even if a file imports `from __future__ import annotations`. +keep-runtime-typing = true diff --git a/examples/default/requirements.in b/examples/default/requirements.in index ff9bb598..7ece66d6 100644 --- a/examples/default/requirements.in +++ b/examples/default/requirements.in @@ -15,11 +15,14 @@ django-flyio django-health-check django-htmx django-q2 +django-q-registry django-simple-history +django-simple-nav django-storages django-stubs django-tailwind-cli django-template-partials +django-twc-toolbox environs[django] gunicorn heroicons diff --git a/examples/default/templates/404.html b/examples/default/templates/404.html index d171a4a8..874ae234 100644 --- a/examples/default/templates/404.html +++ b/examples/default/templates/404.html @@ -1,19 +1,17 @@ {% extends "base.html" %} - {% block content %}

404

-

Oops! The page you're looking for can't be found.

- -

It looks like the page you were trying to reach doesn't exist or has been moved. Don't worry, this happens to the best of us.

- +

+ It looks like the page you were trying to reach doesn't exist or has been moved. Don't worry, this happens to the best of us. +

Here are some helpful links to get you back on track:

- - -

If you still can't find what you're looking for, feel free to reach out to us at [Your Support Email]. We're always here to help.

+

+ If you still can't find what you're looking for, feel free to reach out to us at [Your Support Email]. We're always here to help. +

{% endblock content %} diff --git a/examples/default/templates/500.html b/examples/default/templates/500.html index 549822d9..e0c8464f 100644 --- a/examples/default/templates/500.html +++ b/examples/default/templates/500.html @@ -1,19 +1,17 @@ {% extends "base.html" %} - {% block content %}

500

-

Uh oh! Something went wrong on our end.

- -

We're sorry, but there seems to have been an error while processing your request. Our team has been notified and is working to resolve the issue as quickly as possible.

- +

+ We're sorry, but there seems to have been an error while processing your request. Our team has been notified and is working to resolve the issue as quickly as possible. +

In the meantime, please try one of the following options:

- -

We apologize for the inconvenience and appreciate your patience as we work to resolve this issue.

{% endblock content %} diff --git a/examples/default/templates/base.html b/examples/default/templates/base.html index 27a48a18..93e3c4d9 100644 --- a/examples/default/templates/base.html +++ b/examples/default/templates/base.html @@ -1,37 +1,36 @@ - {% load static %} {% load django_htmx %} {% load tailwind_cli %} - - - - - {% block title %} - Default - {% endblock title %} - - - - {% block css %} - {% endblock css %} - {% tailwind_css %} - - - - - {% django_htmx_script %} - {% if debug %} - + + + + {% django_htmx_script %} + {% if debug %} + - {% endif %} - - - - - {% block javascript_head %} - {% endblock javascript_head %} - - {% block body %} - -
- {% block content %} - {% endblock content %} -
- {% block javascript_foot %} - {% endblock javascript_foot %} - - {% endblock body %} + + {% endif %} + + + + + {% block javascript_head %} + {% endblock javascript_head %} + + {% block body %} + +
+ {% block content %} + {% endblock content %} +
+ {% block javascript_foot %} + {% endblock javascript_foot %} + + {% endblock body %} diff --git a/examples/default/templates/index.html b/examples/default/templates/index.html index f0bf03e1..3e78540b 100644 --- a/examples/default/templates/index.html +++ b/examples/default/templates/index.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -

Index

-

- Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis. -

+

Index

+

+ Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis. +

{% endblock content %} diff --git a/examples/default/tests/test_version.py b/examples/default/tests/test_version.py index 7df255c7..dce1b0c4 100644 --- a/examples/default/tests/test_version.py +++ b/examples/default/tests/test_version.py @@ -4,4 +4,4 @@ def test_version(): - assert __version__ == "2024-2-1" + assert __version__ == "2024.2.1" diff --git a/examples/with_vite/.copier/project.yml b/examples/with_vite/.copier/project.yml index 3713f694..d7d86d28 100644 --- a/examples/with_vite/.copier/project.yml +++ b/examples/with_vite/.copier/project.yml @@ -1,9 +1,9 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 18fc143 +_commit: v2024.1-32-g0acd0b1 _src_path: . admin_email: admin@example.com author_name: John Doe -current_version: 2024-2-1 +current_version: 2024.2.1 default_from_email: johndoe@example.com django_version: '4.2' domain_name: with_vite.westervelt.com diff --git a/examples/with_vite/.github/dependabot.yml b/examples/with_vite/.github/dependabot.yml index d9247db9..8b242e22 100644 --- a/examples/with_vite/.github/dependabot.yml +++ b/examples/with_vite/.github/dependabot.yml @@ -26,7 +26,7 @@ updates: patterns: - "*" exclude-patterns: - - "django-email-relay" + - "django-email-relay" - package-ecosystem: npm directory: "/" schedule: diff --git a/examples/with_vite/.github/workflows/test.yml b/examples/with_vite/.github/workflows/test.yml index f21bb900..2e4282b4 100644 --- a/examples/with_vite/.github/workflows/test.yml +++ b/examples/with_vite/.github/workflows/test.yml @@ -91,6 +91,7 @@ jobs: - name: Build staticfiles run: | + python manage.py tailwind build python manage.py collectstatic # https://hynek.me/articles/ditch-codecov-python/ diff --git a/examples/with_vite/.pre-commit-config.yaml b/examples/with_vite/.pre-commit-config.yaml index 3035326b..00b1923d 100644 --- a/examples/with_vite/.pre-commit-config.yaml +++ b/examples/with_vite/.pre-commit-config.yaml @@ -11,20 +11,20 @@ repos: - id: check-yaml - repo: https://github.com/adamchainz/django-upgrade - rev: 1.15.0 + rev: 1.16.0 hooks: - id: django-upgrade args: [--target-version, "4.2"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + rev: v0.2.1 hooks: - id: ruff args: [--fix] - id: ruff-format - repo: https://github.com/adamchainz/blacken-docs - rev: "1.16.0" + rev: 1.16.0 hooks: - id: blacken-docs alias: autoformat @@ -32,7 +32,7 @@ repos: - black==22.12.0 - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v4.0.0-alpha.8 hooks: - id: prettier # lint the following with prettier: @@ -44,12 +44,11 @@ repos: # ignore any minified code files: '^(?!.*\.min\..*)(?P[\w-]+(\.[\w-]+)*\.(js|jsx|ts|tsx|yml|yaml|css))$' - - repo: https://github.com/rtts/djhtml - rev: "3.0.6" + - repo: https://github.com/djlint/djLint + rev: v1.34.1 hooks: - - id: djhtml - entry: djhtml --tabwidth 2 - alias: autoformat + - id: djlint-reformat-django + - id: djlint-django - repo: local hooks: @@ -57,18 +56,18 @@ repos: name: rustywind Tailwind CSS class linter language: node additional_dependencies: - - rustywind@0.16.0 + - rustywind@0.21.0 entry: rustywind args: [--write] types_or: [html, jsx, tsx] - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.11.0 + rev: v2.12.0 hooks: - id: pretty-format-toml args: [--autofix] - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.15 + rev: v0.16 hooks: - id: validate-pyproject diff --git a/examples/with_vite/pyproject.toml b/examples/with_vite/pyproject.toml index 82cf526d..a4ea4d64 100644 --- a/examples/with_vite/pyproject.toml +++ b/examples/with_vite/pyproject.toml @@ -1,20 +1,38 @@ [tool.bumpver] commit = true commit_message = ":bookmark: bump version {old_version} -> {new_version}" -current_version = "2024-2-1" +current_version = "2024.2.1" push = false # set to false for CI -tag = true +tag = false version_pattern = "YYYY.MM.INC1" [tool.bumpver.file_patterns] +"tests/test_version.py" = [ + 'assert __version__ == "{version}"' +] "with_vite/__init__.py" = [ '__version__ = "{version}"' ] +[tool.coverage.run] +omit = [ + "*/node_modules/*", + "with_vite/*/migrations/*", + "with_vite/asgi.py", + "with_vite/wsgi.py", + "templates/*", + "tests/*", + "manage.py", + "requirements.txt" +] +plugins = ["django_coverage_plugin"] +source = ["with_vite"] + [tool.django-stubs] django_settings_module = "with_vite.settings" [tool.djlint] +ignore = "H031" # Don't require `meta` tag keywords indent = 2 [tool.mypy] @@ -41,6 +59,8 @@ module = [ ignore_missing_imports = true module = [ "allauth.*", + "boto3.*", + "botocore.*", "debug_toolbar.*", "django_filters.*", "django_q.*", @@ -88,7 +108,6 @@ ignore = ["E501", "E741"] # temporary indent-width = 4 # Same as Black. line-length = 88 -per-file-ignores = {} select = [ "B", # flake8-bugbear "E", # Pycodestyle @@ -111,3 +130,11 @@ quote-style = "double" force-single-line = true known-first-party = ["with_vite"] required-imports = ["from __future__ import annotations"] + +[tool.ruff.per-file-ignores] +# Tests can use magic values, assertions, and relative imports +"tests/**/*" = ["PLR2004", "S101", "TID252"] + +[tool.ruff.pyupgrade] +# Preserve types, even if a file imports `from __future__ import annotations`. +keep-runtime-typing = true diff --git a/examples/with_vite/requirements.in b/examples/with_vite/requirements.in index ff9bb598..7ece66d6 100644 --- a/examples/with_vite/requirements.in +++ b/examples/with_vite/requirements.in @@ -15,11 +15,14 @@ django-flyio django-health-check django-htmx django-q2 +django-q-registry django-simple-history +django-simple-nav django-storages django-stubs django-tailwind-cli django-template-partials +django-twc-toolbox environs[django] gunicorn heroicons diff --git a/examples/with_vite/templates/404.html b/examples/with_vite/templates/404.html index d171a4a8..874ae234 100644 --- a/examples/with_vite/templates/404.html +++ b/examples/with_vite/templates/404.html @@ -1,19 +1,17 @@ {% extends "base.html" %} - {% block content %}

404

-

Oops! The page you're looking for can't be found.

- -

It looks like the page you were trying to reach doesn't exist or has been moved. Don't worry, this happens to the best of us.

- +

+ It looks like the page you were trying to reach doesn't exist or has been moved. Don't worry, this happens to the best of us. +

Here are some helpful links to get you back on track:

-
  • Homepage: [Your Website URL]
  • About Us: [Your Website URL]/about-us
  • Contact Us: [Your Website URL]/contact-us
- -

If you still can't find what you're looking for, feel free to reach out to us at [Your Support Email]. We're always here to help.

+

+ If you still can't find what you're looking for, feel free to reach out to us at [Your Support Email]. We're always here to help. +

{% endblock content %} diff --git a/examples/with_vite/templates/500.html b/examples/with_vite/templates/500.html index 549822d9..195614fe 100644 --- a/examples/with_vite/templates/500.html +++ b/examples/with_vite/templates/500.html @@ -1,19 +1,17 @@ {% extends "base.html" %} - {% block content %} -

500

- -

Uh oh! Something went wrong on our end.

- -

We're sorry, but there seems to have been an error while processing your request. Our team has been notified and is working to resolve the issue as quickly as possible.

- -

In the meantime, please try one of the following options:

- -
    -
  • Refresh the page: Simply clicking the refresh button in your browser may resolve the issue.
  • -
  • Try again later: The issue may be temporary, so please try again later.
  • -
  • Contact us: If the problem persists, please contact us at [Your Support Email]. Our team will be more than happy to assist you.
  • -
- -

We apologize for the inconvenience and appreciate your patience as we work to resolve this issue.

+

500

+

Uh oh! Something went wrong on our end.

+

+ We're sorry, but there seems to have been an error while processing your request. Our team has been notified and is working to resolve the issue as quickly as possible. +

+

In the meantime, please try one of the following options:

+
    +
  • Refresh the page: Simply clicking the refresh button in your browser may resolve the issue.
  • +
  • Try again later: The issue may be temporary, so please try again later.
  • +
  • + Contact us: If the problem persists, please contact us at [Your Support Email]. Our team will be more than happy to assist you. +
  • +
+

We apologize for the inconvenience and appreciate your patience as we work to resolve this issue.

{% endblock content %} diff --git a/examples/with_vite/templates/base.html b/examples/with_vite/templates/base.html index 1e293a03..01da2d4d 100644 --- a/examples/with_vite/templates/base.html +++ b/examples/with_vite/templates/base.html @@ -1,4 +1,3 @@ - {% load static %} {% load django_htmx %} {% load tailwind_cli %} diff --git a/examples/with_vite/templates/index.html b/examples/with_vite/templates/index.html index f0bf03e1..3e78540b 100644 --- a/examples/with_vite/templates/index.html +++ b/examples/with_vite/templates/index.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -

Index

-

- Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis. -

+

Index

+

+ Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis. +

{% endblock content %} diff --git a/examples/with_vite/tests/test_version.py b/examples/with_vite/tests/test_version.py index 88712ba6..596fba4d 100644 --- a/examples/with_vite/tests/test_version.py +++ b/examples/with_vite/tests/test_version.py @@ -4,4 +4,4 @@ def test_version(): - assert __version__ == "2024-2-1" + assert __version__ == "2024.2.1" diff --git a/examples/with_vite/with_vite/__init__.py b/examples/with_vite/with_vite/__init__.py index b167807a..75606775 100644 --- a/examples/with_vite/with_vite/__init__.py +++ b/examples/with_vite/with_vite/__init__.py @@ -1,3 +1,4 @@ from __future__ import annotations -__version__ = "2024-2-1" +__version__ = "2024.2.1" +__template_version__ = "2024.2" diff --git a/examples/with_vite/with_vite/core/views.py b/examples/with_vite/with_vite/core/views.py index 0c84b33a..f90c3874 100644 --- a/examples/with_vite/with_vite/core/views.py +++ b/examples/with_vite/with_vite/core/views.py @@ -1,10 +1,14 @@ from __future__ import annotations -from django.conf import settings +from pathlib import Path + from django.contrib.auth.decorators import login_required +from django.contrib.staticfiles import finders from django.http import FileResponse from django.http import HttpRequest from django.http import HttpResponse +from django.http import HttpResponseNotFound +from django.shortcuts import redirect from django.shortcuts import render from django.utils import timezone from django.views.decorators.cache import cache_control @@ -45,10 +49,18 @@ def security_txt(request: HttpRequest) -> HttpResponse: @require_GET @cache_control(max_age=60 * 60 * 24, immutable=True, public=True) # one day -def favicon(request: HttpRequest) -> FileResponse: +def favicon(request: HttpRequest) -> HttpResponse | FileResponse: name = request.path.lstrip("/") - file = (settings.BASE_DIR / "static" / "public" / name).open("rb") - return FileResponse(file) + path = finders.find(name) + if path: + file = Path(path).open("rb") + response = FileResponse(file) + else: + if name == "favicon.ico": + response = HttpResponseNotFound() + else: + response = redirect("favicon.ico") + return response @require_GET diff --git a/examples/with_vite/with_vite/settings.py b/examples/with_vite/with_vite/settings.py index e497b98d..6a27225a 100644 --- a/examples/with_vite/with_vite/settings.py +++ b/examples/with_vite/with_vite/settings.py @@ -72,7 +72,7 @@ "email_relay.db.EmailDatabaseRouter", ] -DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" +DEFAULT_AUTO_FIELD = "django.db.models.AutoField" DEFAULT_FROM_EMAIL = env( "DEFAULT_FROM_EMAIL", @@ -85,11 +85,15 @@ else "email_relay.backend.RelayDatabaseEmailBackend" ) +FORM_RENDERER = "django.forms.renderers.TemplatesSetting" + INSTALLED_APPS = [ # First Party "with_vite.core", "with_vite.users", # Second Party + "django_q_registry", + "django_simple_nav", "django_twc_ui", "django_twc_ui.forms", "email_relay", @@ -333,7 +337,7 @@ ACCOUNT_USERNAME_REQUIRED = False -LOGIN_REDIRECT_URL = "dashboard" +LOGIN_REDIRECT_URL = "index" SOCIALACCOUNT_PROVIDERS = { "okta": { diff --git a/examples/with_vite/with_vite/users/migrations/0001_initial.py b/examples/with_vite/with_vite/users/migrations/0001_initial.py index b3014c8e..6e9d3633 100644 --- a/examples/with_vite/with_vite/users/migrations/0001_initial.py +++ b/examples/with_vite/with_vite/users/migrations/0001_initial.py @@ -19,7 +19,7 @@ class Migration(migrations.Migration): fields=[ ( "id", - models.BigAutoField( + models.AutoField( auto_created=True, primary_key=True, serialize=False, diff --git a/examples/with_vite/with_vite/users/views.py b/examples/with_vite/with_vite/users/views.py deleted file mode 100644 index e69de29b..00000000 diff --git a/pyproject.toml b/pyproject.toml index 828e9006..c778a7f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ requires-python = ">= 3.8" [tool.bumpver] commit = true commit_message = ":bookmark: bump version {old_version} -> {new_version}" -current_version = "2024.1" +current_version = "2024.2" push = false # set to false for CI tag = false version_pattern = "YYYY.INC1" diff --git a/src/django_twc_project/templates/404.html b/src/django_twc_project/templates/404.html index 874ae234..17361ae0 100644 --- a/src/django_twc_project/templates/404.html +++ b/src/django_twc_project/templates/404.html @@ -1,17 +1,17 @@ {% extends "base.html" %} {% block content %} -

404

-

Oops! The page you're looking for can't be found.

-

- It looks like the page you were trying to reach doesn't exist or has been moved. Don't worry, this happens to the best of us. -

-

Here are some helpful links to get you back on track:

-
    -
  • Homepage: [Your Website URL]
  • -
  • About Us: [Your Website URL]/about-us
  • -
  • Contact Us: [Your Website URL]/contact-us
  • -
-

- If you still can't find what you're looking for, feel free to reach out to us at [Your Support Email]. We're always here to help. -

+

404

+

Oops! The page you're looking for can't be found.

+

+ It looks like the page you were trying to reach doesn't exist or has been moved. Don't worry, this happens to the best of us. +

+

Here are some helpful links to get you back on track:

+
    +
  • Homepage: [Your Website URL]
  • +
  • About Us: [Your Website URL]/about-us
  • +
  • Contact Us: [Your Website URL]/contact-us
  • +
+

+ If you still can't find what you're looking for, feel free to reach out to us at [Your Support Email]. We're always here to help. +

{% endblock content %} diff --git a/src/django_twc_project/templates/index.html b/src/django_twc_project/templates/index.html index 3e78540b..b02fba3a 100644 --- a/src/django_twc_project/templates/index.html +++ b/src/django_twc_project/templates/index.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -

Index

-

- Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis. -

+

Index

+

+ Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis. +

{% endblock content %} diff --git a/tests/test_version.py b/tests/test_version.py index 7b28db28..1eeffef8 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -13,7 +13,7 @@ def test_copier_yml_version(): version = copier_yml["template_version"]["default"] - assert version == "2024.1" + assert version == "2024.2" def test_VERSION_version(): @@ -21,4 +21,4 @@ def test_VERSION_version(): with open(file, encoding="utf-8") as f: version = f.read().strip() - assert version == "2024.1" + assert version == "2024.2"