From 5f883f96c04f398787a8d2bb6110d835f4746fee Mon Sep 17 00:00:00 2001 From: Jason Heppler Date: Tue, 27 Aug 2024 16:17:59 -0500 Subject: [PATCH 1/6] feat: Add Wagtail to handle content pages --- config/settings.py | 33 +- config/urls.py | 6 + pages/__init__.py | 0 pages/admin.py | 3 + pages/apps.py | 6 + pages/migrations/0001_initial.py | 58 ++++ pages/migrations/0002_aboutpage_team.py | 18 ++ ...0003_sitepage_delete_specificationspage.py | 39 +++ pages/migrations/__init__.py | 0 pages/models.py | 21 ++ pages/tests.py | 3 + pages/urls.py | 8 + pages/views.py | 14 + poetry.lock | 293 +++++++++++++++++- pyproject.toml | 1 + templates/pages/about_page.html | 25 ++ 16 files changed, 525 insertions(+), 3 deletions(-) create mode 100644 pages/__init__.py create mode 100644 pages/admin.py create mode 100644 pages/apps.py create mode 100644 pages/migrations/0001_initial.py create mode 100644 pages/migrations/0002_aboutpage_team.py create mode 100644 pages/migrations/0003_sitepage_delete_specificationspage.py create mode 100644 pages/migrations/__init__.py create mode 100644 pages/models.py create mode 100644 pages/tests.py create mode 100644 pages/urls.py create mode 100644 pages/views.py create mode 100644 templates/pages/about_page.html diff --git a/config/settings.py b/config/settings.py index d1e8973..6856b0a 100644 --- a/config/settings.py +++ b/config/settings.py @@ -49,6 +49,19 @@ "allauth", "allauth.account", "allauth.socialaccount", + "wagtail.contrib.forms", + "wagtail.contrib.redirects", + "wagtail.embeds", + "wagtail.sites", + "wagtail.users", + "wagtail.snippets", + "wagtail.documents", + "wagtail.images", + "wagtail.search", + "wagtail.admin", + "wagtail", + "modelcluster", + "taggit", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.staticfiles", @@ -62,6 +75,7 @@ "accounts", "manuscript", "map", + "pages", ] MIDDLEWARE = [ @@ -75,6 +89,7 @@ "django.middleware.locale.LocaleMiddleware", "allauth.account.middleware.AccountMiddleware", "django_browser_reload.middleware.BrowserReloadMiddleware", + "wagtail.contrib.redirects.middleware.RedirectMiddleware", ] ROOT_URLCONF = "config.urls" @@ -173,12 +188,26 @@ # https://docs.djangoproject.com/en/5.0/howto/static-files/ STATIC_ROOT = str(BASE_DIR / "staticfiles") -STATIC_URL = "static/" +STATIC_URL = "/static/" STATICFILES_DIRS = [ BASE_DIR / "static", ] MEDIA_ROOT = str(BASE_DIR / "media") -MEDIA_URL = "media/" +MEDIA_URL = "/media/" + +# Wagtail settings +WAGTAIL_SITE_NAME = "La Sfera" +WAGTAILADMIN_BASE_URL = "https://dev.lasfera.rrchnm.org" +WAGTAILDOCS_EXTENSIONS = [ + "csv", + "docx", + "key", + "odt", + "pdf", + "rtf", + "txt", + "xlsx", +] # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field diff --git a/config/urls.py b/config/urls.py index 233ba9b..72846f0 100644 --- a/config/urls.py +++ b/config/urls.py @@ -3,6 +3,9 @@ from django.contrib import admin from django.contrib.auth import views as auth_views from django.urls import include, path +from wagtail import urls as wagtail_urls +from wagtail.admin import urls as wagtailadmin_urls +from wagtail.documents import urls as wagtaildocs_urls urlpatterns = [ path("", include("manuscript.urls")), @@ -12,5 +15,8 @@ path("login/", auth_views.LoginView.as_view(), name="login"), path("logout/", auth_views.LogoutView.as_view(), name="logout"), path("prose/", include("prose.urls")), + path("cms/", include(wagtailadmin_urls)), + path("documents/", include(wagtaildocs_urls)), + path("pages/", include(wagtail_urls)), path("__reload__/", include("django_browser_reload.urls")), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/pages/__init__.py b/pages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pages/admin.py b/pages/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/pages/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/pages/apps.py b/pages/apps.py new file mode 100644 index 0000000..4b6237c --- /dev/null +++ b/pages/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class PagesConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "pages" diff --git a/pages/migrations/0001_initial.py b/pages/migrations/0001_initial.py new file mode 100644 index 0000000..bee56a5 --- /dev/null +++ b/pages/migrations/0001_initial.py @@ -0,0 +1,58 @@ +# Generated by Django 5.0.2 on 2024-08-27 19:26 + +import django.db.models.deletion +import wagtail.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + initial = True + + dependencies = [ + ("wagtailcore", "0094_alter_page_locale"), + ] + + operations = [ + migrations.CreateModel( + name="AboutPage", + fields=[ + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.page", + ), + ), + ("body", wagtail.fields.RichTextField(blank=True)), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + migrations.CreateModel( + name="SpecificationsPage", + fields=[ + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.page", + ), + ), + ("body", wagtail.fields.RichTextField(blank=True)), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + ] diff --git a/pages/migrations/0002_aboutpage_team.py b/pages/migrations/0002_aboutpage_team.py new file mode 100644 index 0000000..5420e68 --- /dev/null +++ b/pages/migrations/0002_aboutpage_team.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.2 on 2024-08-27 19:51 + +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("pages", "0001_initial"), + ] + + operations = [ + migrations.AddField( + model_name="aboutpage", + name="team", + field=wagtail.fields.RichTextField(blank=True), + ), + ] diff --git a/pages/migrations/0003_sitepage_delete_specificationspage.py b/pages/migrations/0003_sitepage_delete_specificationspage.py new file mode 100644 index 0000000..c18ebc0 --- /dev/null +++ b/pages/migrations/0003_sitepage_delete_specificationspage.py @@ -0,0 +1,39 @@ +# Generated by Django 5.0.2 on 2024-08-27 20:17 + +import django.db.models.deletion +import wagtail.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("pages", "0002_aboutpage_team"), + ("wagtailcore", "0094_alter_page_locale"), + ] + + operations = [ + migrations.CreateModel( + name="SitePage", + fields=[ + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.page", + ), + ), + ("body", wagtail.fields.RichTextField(blank=True)), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + migrations.DeleteModel( + name="SpecificationsPage", + ), + ] diff --git a/pages/migrations/__init__.py b/pages/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pages/models.py b/pages/models.py new file mode 100644 index 0000000..184acef --- /dev/null +++ b/pages/models.py @@ -0,0 +1,21 @@ +from django.db import models +from wagtail.admin.panels import FieldPanel +from wagtail.fields import RichTextField +from wagtail.models import Page + + +class AboutPage(Page): + body = RichTextField(blank=True) + team = RichTextField(blank=True) + + content_panels = Page.content_panels + [ + FieldPanel("body", classname="full"), + FieldPanel("team", classname="full"), + ] + + +class SitePage(Page): + body = RichTextField(blank=True) + content_panels = Page.content_panels + [ + FieldPanel("body", classname="full"), + ] diff --git a/pages/tests.py b/pages/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/pages/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/pages/urls.py b/pages/urls.py new file mode 100644 index 0000000..4d02e1c --- /dev/null +++ b/pages/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from pages.models import AboutPage +from pages.views import about + +urlpatterns = [ + # path("about/", about, name="about"), +] diff --git a/pages/views.py b/pages/views.py new file mode 100644 index 0000000..8cb0bbb --- /dev/null +++ b/pages/views.py @@ -0,0 +1,14 @@ +from django.shortcuts import render + +from pages.models import AboutPage + +# def about(request): +# about_page = AboutPage.objects.live().first() + +# return render( +# request, +# "base.html", +# { +# "about_page": about_page, +# }, +# ) diff --git a/poetry.lock b/poetry.lock index 446e5ef..f2205c3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,5 +1,16 @@ # This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +[[package]] +name = "anyascii" +version = "0.3.2" +description = "Unicode to ASCII transliteration" +optional = false +python-versions = ">=3.3" +files = [ + {file = "anyascii-0.3.2-py3-none-any.whl", hash = "sha256:3b3beef6fc43d9036d3b0529050b0c48bfad8bc960e9e562d7223cfb94fe45d4"}, + {file = "anyascii-0.3.2.tar.gz", hash = "sha256:9d5d32ef844fe225b8bc7cba7f950534fae4da27a9bf3a6bea2cb0ea46ce4730"}, +] + [[package]] name = "asgiref" version = "3.7.2" @@ -455,6 +466,20 @@ develop = ["coverage[toml] (>=5.0a4)", "furo (>=2021.8.17b43,<2021.9.dev0)", "py docs = ["furo (>=2021.8.17b43,<2021.9.dev0)", "sphinx (>=3.5.0)", "sphinx-notfound-page"] testing = ["coverage[toml] (>=5.0a4)", "pytest (>=4.6.11)"] +[[package]] +name = "django-filter" +version = "24.3" +description = "Django-filter is a reusable Django application for allowing users to filter querysets dynamically." +optional = false +python-versions = ">=3.8" +files = [ + {file = "django_filter-24.3-py3-none-any.whl", hash = "sha256:c4852822928ce17fb699bcfccd644b3574f1a2d80aeb2b4ff4f16b02dd49dc64"}, + {file = "django_filter-24.3.tar.gz", hash = "sha256:d8ccaf6732afd21ca0542f6733b11591030fa98669f8d15599b358e24a2cd9c3"}, +] + +[package.dependencies] +Django = ">=4.2" + [[package]] name = "django-import-export" version = "4.0.3" @@ -480,6 +505,24 @@ xls = ["tablib[xls] (==3.5.0)"] xlsx = ["tablib[xlsx] (==3.5.0)"] yaml = ["tablib[yaml] (==3.5.0)"] +[[package]] +name = "django-modelcluster" +version = "6.3" +description = "Django extension to allow working with 'clusters' of models as a single unit, independently of the database" +optional = false +python-versions = ">=3.8" +files = [ + {file = "django-modelcluster-6.3.tar.gz", hash = "sha256:0caed8a0e889f3abb92f144670878a466ef954ffa6c4c7b9c80e6426b720a49d"}, + {file = "django_modelcluster-6.3-py2.py3-none-any.whl", hash = "sha256:a8783d6565a0663f41cd6003ea361c3a5711e8a2a326160f1ec1eceb3e973d4f"}, +] + +[package.dependencies] +django = ">=3.2" +pytz = ">=2022.4" + +[package.extras] +taggit = ["django-taggit (>=3.1)"] + [[package]] name = "django-nested-admin" version = "4.0.2" @@ -498,6 +541,23 @@ python-monkey-business = ">=1.0.0" dev = ["Pillow", "black", "dj-database-url", "django-selenosis", "flake8", "pytest", "pytest-cov", "pytest-django", "pytest-xdist", "selenium"] test = ["Pillow", "dj-database-url", "django-selenosis", "pytest", "pytest-cov", "pytest-django", "pytest-xdist", "selenium"] +[[package]] +name = "django-permissionedforms" +version = "0.1" +description = "Django extension for creating forms that vary according to user permissions" +optional = false +python-versions = ">=3.7" +files = [ + {file = "django-permissionedforms-0.1.tar.gz", hash = "sha256:4340bb20c4477fffb13b4cc5cccf9f1b1010b64f79956c291c72d2ad2ed243f8"}, + {file = "django_permissionedforms-0.1-py2.py3-none-any.whl", hash = "sha256:d341a961a27cc77fde8cc42141c6ab55cc1f0cb886963cc2d6967b9674fa47d6"}, +] + +[package.dependencies] +Django = "*" + +[package.extras] +testing = ["django-modelcluster"] + [[package]] name = "django-prose" version = "2.0.0" @@ -530,6 +590,20 @@ django = ">=4.2" [package.extras] tests = ["coverage", "nh3"] +[[package]] +name = "django-taggit" +version = "5.0.1" +description = "django-taggit is a reusable Django application for simple tagging." +optional = false +python-versions = ">=3.8" +files = [ + {file = "django-taggit-5.0.1.tar.gz", hash = "sha256:edcd7db1e0f35c304e082a2f631ddac2e16ef5296029524eb792af7430cab4cc"}, + {file = "django_taggit-5.0.1-py3-none-any.whl", hash = "sha256:a0ca8a28b03c4b26c2630fd762cb76ec39b5e41abf727a7b66f897a625c5e647"}, +] + +[package.dependencies] +Django = ">=4.1" + [[package]] name = "django-tailwind" version = "3.8.0" @@ -562,6 +636,20 @@ files = [ [package.dependencies] django = ">=3.2" +[[package]] +name = "django-treebeard" +version = "4.7.1" +description = "Efficient tree implementations for Django" +optional = false +python-versions = ">=3.8" +files = [ + {file = "django-treebeard-4.7.1.tar.gz", hash = "sha256:846e462904b437155f76e04907ba4e48480716855f88b898df4122bdcfbd6e98"}, + {file = "django_treebeard-4.7.1-py3-none-any.whl", hash = "sha256:995c7120153ab999898fe3043bbdcd8a0fc77cc106eb94de7350e9d02c885135"}, +] + +[package.dependencies] +Django = ">=3.2" + [[package]] name = "djangorestframework" version = "3.15.2" @@ -576,6 +664,21 @@ files = [ [package.dependencies] django = ">=4.2" +[[package]] +name = "draftjs-exporter" +version = "5.0.0" +description = "Library to convert rich text from Draft.js raw ContentState to HTML" +optional = false +python-versions = "*" +files = [ + {file = "draftjs_exporter-5.0.0-py3-none-any.whl", hash = "sha256:8cb9d2d51284233decfe274802f1c53e257158c62b9f53ed2399de3fa80ac561"}, + {file = "draftjs_exporter-5.0.0.tar.gz", hash = "sha256:2efee45d4bb4c0aaacc3e5ea2983a29a29381e02037f3f92a6b12706d7b87e1e"}, +] + +[package.extras] +html5lib = ["beautifulsoup4 (>=4.4.1,<5)", "html5lib (>=0.999,<2)"] +lxml = ["lxml (>=4.2.0,<5)"] + [[package]] name = "et-xmlfile" version = "1.1.0" @@ -587,6 +690,17 @@ files = [ {file = "et_xmlfile-1.1.0.tar.gz", hash = "sha256:8eb9e2bc2f8c97e37a2dc85a09ecdcdec9d8a396530a6d5a33b30b9a92da0c5c"}, ] +[[package]] +name = "filetype" +version = "1.2.0" +description = "Infer file type and MIME type of any file/buffer. No external dependencies." +optional = false +python-versions = "*" +files = [ + {file = "filetype-1.2.0-py2.py3-none-any.whl", hash = "sha256:7ce71b6880181241cf7ac8697a2f1eb6a8bd9b429f7ad6d27b8db9ba5f1c2d25"}, + {file = "filetype-1.2.0.tar.gz", hash = "sha256:66b56cd6474bf41d8c54660347d37afcc3f7d1970648de365c102ef77548aadb"}, +] + [[package]] name = "fontawesomefree" version = "6.6.0" @@ -656,6 +770,39 @@ files = [ [package.extras] colors = ["colorama (>=0.4.6)"] +[[package]] +name = "l18n" +version = "2021.3" +description = "Internationalization for pytz timezones and territories" +optional = false +python-versions = "*" +files = [ + {file = "l18n-2021.3-py3-none-any.whl", hash = "sha256:78495d1df95b6f7dcc694d1ba8994df709c463a1cbac1bf016e1b9a5ce7280b9"}, + {file = "l18n-2021.3.tar.gz", hash = "sha256:1956e890d673d17135cc20913253c154f6bc1c00266c22b7d503cc1a5a42d848"}, +] + +[package.dependencies] +pytz = ">=2020.1" +six = "*" + +[[package]] +name = "laces" +version = "0.1.1" +description = "Django components that know how to render themselves." +optional = false +python-versions = ">=3.8" +files = [ + {file = "laces-0.1.1-py3-none-any.whl", hash = "sha256:ae2c575b9aaa46154e5518c61c9f86f5a9478f753a51e9c5547c7d275d361242"}, + {file = "laces-0.1.1.tar.gz", hash = "sha256:e45159c46f6adca33010d34e9af869e57201b70675c6dc088e919b16c89456a4"}, +] + +[package.dependencies] +Django = ">=3.2" + +[package.extras] +dev = ["black (==24.1.1)", "blacken-docs (==1.16.0)", "coverage (==7.3.4)", "django-stubs[compatible-mypy] (==4.2.7)", "flake8 (==7.0.0)", "flake8-bugbear", "flake8-comprehensions", "isort (==5.13.2)", "mypy (==1.7.1)", "pre-commit (==3.4.0)", "tox (==4.12.1)", "tox-gh-actions (==3.2.0)", "types-requests (==2.31.0.20240125)", "virtualenv-pyenv (==0.4.0)"] +testing = ["coverage (==7.3.4)", "dj-database-url (==2.1.0)"] + [[package]] name = "mccabe" version = "0.7.0" @@ -899,6 +1046,76 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa typing = ["typing-extensions"] xmp = ["defusedxml"] +[[package]] +name = "pillow-heif" +version = "0.18.0" +description = "Python interface for libheif library" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pillow_heif-0.18.0-cp310-cp310-macosx_12_0_x86_64.whl", hash = "sha256:e1ad1d97f42fc39de8639b3f45d4d053e00158fc64f1674a14d8912cf81791e3"}, + {file = "pillow_heif-0.18.0-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:c45b8d19d8bb1fc61f1f648d042da16d9085506055665a64b56ce8d8ed83c42b"}, + {file = "pillow_heif-0.18.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d524458837bdc5410f66de8e68e864bd179d19a1c205daf7f8c9a07194cc5615"}, + {file = "pillow_heif-0.18.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2f032593b3cfc96970efc91860ef6eaa62b1e661418d7f9ec186dff9ac7c9844"}, + {file = "pillow_heif-0.18.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:06649ea6bfac8ca5e7ac898c78c4aad2fd0bc1ce278fa86c503170010902193b"}, + {file = "pillow_heif-0.18.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8612f4c2e8a3388647c3ce0b7810398cf941aceecd4b2c7790331a53117baf10"}, + {file = "pillow_heif-0.18.0-cp310-cp310-win_amd64.whl", hash = "sha256:a7cc374452f5b00cf44171a7bfc08c016b0c0a9f226a99369ffbeb13fd45fa7b"}, + {file = "pillow_heif-0.18.0-cp311-cp311-macosx_12_0_x86_64.whl", hash = "sha256:a5d8bfcf8b23b67b8937bcc25fd464f1ca383d3d1d65220463be81ccf6c8185b"}, + {file = "pillow_heif-0.18.0-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:2a4c41e76f2da4e046f170cb3716b7aedc466a194509bc0bf1a7c735d5278b8c"}, + {file = "pillow_heif-0.18.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:68781589ee03bf4bd670e55444c25cb0784451b0beacfb0f79d7f56ae497a767"}, + {file = "pillow_heif-0.18.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8782f9f82c534f4a37ce3c609505f992f340a495da1247951108218a201d0e9"}, + {file = "pillow_heif-0.18.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:2902460d60843e2c379320f1b752a6d4879e3ab0479674ee323d7dee487cccc8"}, + {file = "pillow_heif-0.18.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:c8bebd570446a7b4f7db5ca8eb333dd4591fda13524bc49eee34b3f5cf40741b"}, + {file = "pillow_heif-0.18.0-cp311-cp311-win_amd64.whl", hash = "sha256:4476bbd7bb7cc1d94c35f0c85786dbe528661bc937422db03fdc865b9ee91d30"}, + {file = "pillow_heif-0.18.0-cp312-cp312-macosx_12_0_x86_64.whl", hash = "sha256:c795e7ccceea33e01e49ce536139f94cabb1bf017393666f76c05a9daebae2da"}, + {file = "pillow_heif-0.18.0-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:4dd5b3ec09be45c1ef63be31773df90e18ee08e5e950018b0a349924b54a24ac"}, + {file = "pillow_heif-0.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eb2eade59c2654c2643a3b637de37c19e75a77c66a3e9a5e0ae26210e4f48aee"}, + {file = "pillow_heif-0.18.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:35b59d599bfdb8454739db6b92f0841ecadbe887babb5ed5abd5299587843eef"}, + {file = "pillow_heif-0.18.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:26a0b8b8e899e7bcc876ee61fcadb0f0b849bd6a0d5c20f0e969c77a43b40568"}, + {file = "pillow_heif-0.18.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0276a3e0c667677ed0c67f4512cdf2f674065018049307ba4de5cb4648b0a33e"}, + {file = "pillow_heif-0.18.0-cp312-cp312-win_amd64.whl", hash = "sha256:5916fa31f2015626dd2372d14e24521ea6caed11b25be14faa9b9c67731087ce"}, + {file = "pillow_heif-0.18.0-cp313-cp313-macosx_12_0_x86_64.whl", hash = "sha256:ca554f086bc146f1a798adcd77fdecd81564cc0cd74802ee61e3869ab87282f7"}, + {file = "pillow_heif-0.18.0-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:2821d30d22bbb94c2a0fae25eb566421bf22c909958e031d3f0973b482b88515"}, + {file = "pillow_heif-0.18.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8376309e178f39a2891183cb9662f1c2c87b8614ff13871f077f89edf65ecf48"}, + {file = "pillow_heif-0.18.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3549e26a65e04e7e986888993b03aae0f848576c2404b5edf12d7db76ef2e72b"}, + {file = "pillow_heif-0.18.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0138a08ed90e54c230878c0b8cb92447ad591b7b2e86bfca145029322ba384c7"}, + {file = "pillow_heif-0.18.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f552419c8bd754603f1dfbc7f8cdd666118fdd3d063d67974c5bd5a8d7fed9de"}, + {file = "pillow_heif-0.18.0-cp313-cp313-win_amd64.whl", hash = "sha256:be148b8463ac5d25fdf94d70c69a53712890cd3974ead906c98e7bf35fc96ba6"}, + {file = "pillow_heif-0.18.0-cp38-cp38-macosx_12_0_x86_64.whl", hash = "sha256:bca173920f16ea8d1c40a970f002be15ac34a5fa99d39403a85472e265db2357"}, + {file = "pillow_heif-0.18.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d8e8e9860259688700f13baed015632c4ddaf813d26cc856e37ebf0a3f171661"}, + {file = "pillow_heif-0.18.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21b9080d96d51158774e3022fc9af19b650863cbb23fac991458cb354b1aa63d"}, + {file = "pillow_heif-0.18.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:5b2ee478e373c0502dc431b22840dd0c551c4ce0e1007ab13f038a868ed375c1"}, + {file = "pillow_heif-0.18.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:35d2d7199dc34f28aef39cec984c043b1ee30d5c46048566584dc61cf4108c09"}, + {file = "pillow_heif-0.18.0-cp38-cp38-win_amd64.whl", hash = "sha256:d399ac5fb499c8feb9770503db25073dfeaccd01238bcb6aaf01354cd83db123"}, + {file = "pillow_heif-0.18.0-cp39-cp39-macosx_12_0_x86_64.whl", hash = "sha256:3af89fa7a73143bc49fc18f92b1a6c0fa68ecb56fb56224fb369c2f56729fbb6"}, + {file = "pillow_heif-0.18.0-cp39-cp39-macosx_14_0_arm64.whl", hash = "sha256:8b0b9a66e604aef2d0a19a7cb2247c5f9b3352827bb1b00816053ce4982ec8ab"}, + {file = "pillow_heif-0.18.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:02af8950d190e3bea28ed2d0ca40798eeae88eaf6e099ee44ec654667f979d97"}, + {file = "pillow_heif-0.18.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:165430447de0f7da259eb07d9487571784912a64c75cd0c52d0d506c114ec7ce"}, + {file = "pillow_heif-0.18.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:7666cbab98246cf9355625e66bf1bb885fdcf8ff4a917f4db04231e80ea692ee"}, + {file = "pillow_heif-0.18.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:f403aadee232509ee2fdedbfda2dd0bae75098e70a8ddcc010061f92ab962517"}, + {file = "pillow_heif-0.18.0-cp39-cp39-win_amd64.whl", hash = "sha256:7ed6cc5ea21f04b15b7604e20592e0ee760ee10fb2da2209b85c94bf0b6f1034"}, + {file = "pillow_heif-0.18.0-pp310-pypy310_pp73-macosx_12_0_x86_64.whl", hash = "sha256:744b8a00a817e7139a7e2fd296092689116700dfd63e34941abdc8ae85b3a982"}, + {file = "pillow_heif-0.18.0-pp310-pypy310_pp73-macosx_14_0_arm64.whl", hash = "sha256:89b1d63be7e8036ab45f0cd58e27e54113cfd7e852e91606b5cec4fa788a503f"}, + {file = "pillow_heif-0.18.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d9a8ab9803d79e84e7751cc0930d381112efbf71461ca123a5c2b7abf1050c72"}, + {file = "pillow_heif-0.18.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7649431ea30a9c342888d814f07d2aed9cab06ef5fe5bf065d514eceb2c8d24e"}, + {file = "pillow_heif-0.18.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:8ee07e334f99bdf399d207bb19653496c65fcbf006f2cee964047f6d6d57acd9"}, + {file = "pillow_heif-0.18.0-pp39-pypy39_pp73-macosx_12_0_x86_64.whl", hash = "sha256:4148a7f17d184c815f428949d6e60582136ef0802a7462c842ee9fe15ca9be16"}, + {file = "pillow_heif-0.18.0-pp39-pypy39_pp73-macosx_14_0_arm64.whl", hash = "sha256:5908e8079f62ec8ace9e7c554691a82ece088d0945d980a877e981f208e85193"}, + {file = "pillow_heif-0.18.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28358d5e4e3aeb4af2a60a20187099ba03ab8619bcec8212900657371778da96"}, + {file = "pillow_heif-0.18.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8988a9ce18425aff189913905ce28e61220061c3f222e08213eb473b88a41a20"}, + {file = "pillow_heif-0.18.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7ef23775de70124a02ad9be69af58126ec63a2e2987495355e75cabb265c01cb"}, + {file = "pillow_heif-0.18.0.tar.gz", hash = "sha256:70318dad9faa76121c6592ac0ab59881ff0dac6ab791a922e70d82c7706cce88"}, +] + +[package.dependencies] +pillow = ">=10.1.0" + +[package.extras] +dev = ["coverage", "defusedxml", "numpy", "opencv-python (==4.10.0.84)", "packaging", "pre-commit", "pylint", "pympler", "pytest"] +docs = ["sphinx (>=4.4)", "sphinx-issues (>=3.0.1)", "sphinx-rtd-theme (>=1.0)"] +tests = ["defusedxml", "numpy", "packaging", "pympler", "pytest"] +tests-min = ["defusedxml", "packaging", "pytest"] + [[package]] name = "platformdirs" version = "4.2.0" @@ -1198,6 +1415,20 @@ xls = ["xlrd", "xlwt"] xlsx = ["openpyxl (>=2.6.0)"] yaml = ["pyyaml"] +[[package]] +name = "telepath" +version = "0.3.1" +description = "A library for exchanging data between Python and JavaScript" +optional = false +python-versions = ">=3.8" +files = [ + {file = "telepath-0.3.1-py38-none-any.whl", hash = "sha256:c280aa8e77ad71ce80e96500a4e4d4a32f35b7e0b52e896bb5fde9a5bcf0699a"}, + {file = "telepath-0.3.1.tar.gz", hash = "sha256:925c0609e0a8a6488ec4a55b19d485882cf72223b2b19fe2359a50fddd813c9c"}, +] + +[package.extras] +docs = ["mkdocs (>=1.1,<1.2)", "mkdocs-material (>=6.2,<6.3)"] + [[package]] name = "text-unidecode" version = "1.3" @@ -1248,6 +1479,40 @@ h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] +[[package]] +name = "wagtail" +version = "6.2.1" +description = "A Django content management system." +optional = false +python-versions = ">=3.8" +files = [ + {file = "wagtail-6.2.1-py3-none-any.whl", hash = "sha256:31d073ea8acdc973ef45c5719977a1bb122ad0fc3f01348f37e922128200b42a"}, + {file = "wagtail-6.2.1.tar.gz", hash = "sha256:0f136ef23b157997a44fa46543a320a31437350951cf13add8ea8b69cc5e8385"}, +] + +[package.dependencies] +anyascii = ">=0.1.5" +beautifulsoup4 = ">=4.8,<4.13" +Django = ">=4.2,<6.0" +django-filter = ">=23.3,<25" +django-modelcluster = ">=6.2.1,<7.0" +django-permissionedforms = ">=0.1,<1.0" +django-taggit = ">=5.0,<5.1" +django-treebeard = ">=4.5.1,<5.0" +djangorestframework = ">=3.15.1,<4.0" +draftjs-exporter = ">=2.1.5,<6.0" +l18n = ">=2018.5" +laces = ">=0.1,<0.2" +openpyxl = ">=3.0.10,<4.0" +Pillow = ">=9.1.0,<11.0.0" +requests = ">=2.11.1,<3.0" +telepath = ">=0.3.1,<1" +Willow = {version = ">=1.8.0,<2", extras = ["heif"]} + +[package.extras] +docs = ["Sphinx (>=7.0)", "myst-parser (==2.0.0)", "pyenchant (>=3.1.1,<4)", "sphinx-autobuild (>=0.6.0)", "sphinx-copybutton (>=0.5,<1.0)", "sphinx-wagtail-theme (==6.3.0)", "sphinxcontrib-spelling (>=7,<8)"] +testing = ["Jinja2 (>=3.0,<3.2)", "azure-mgmt-cdn (>=12.0,<13.0)", "azure-mgmt-frontdoor (>=1.0,<1.1)", "boto3 (>=1.28,<2)", "coverage (>=3.7.0)", "curlylint (==0.13.1)", "django-pattern-library (>=0.7)", "djhtml (==3.0.6)", "doc8 (==0.8.1)", "factory-boy (>=3.2)", "freezegun (>=0.3.8)", "polib (>=1.1,<2.0)", "python-dateutil (>=2.7)", "pytz (>=2014.7)", "ruff (==0.1.5)", "semgrep (==1.40.0)", "tblib (>=2.0,<3.0)"] + [[package]] name = "webencodings" version = "0.5.1" @@ -1259,7 +1524,33 @@ files = [ {file = "webencodings-0.5.1.tar.gz", hash = "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923"}, ] +[[package]] +name = "willow" +version = "1.8.0" +description = "A Python image library that sits on top of Pillow, Wand and OpenCV" +optional = false +python-versions = ">=3.8" +files = [ + {file = "willow-1.8.0-py3-none-any.whl", hash = "sha256:48ccf5ce48ccd29c37a32497cd7af50983f8570543c4de2988b15d583efc66be"}, + {file = "willow-1.8.0.tar.gz", hash = "sha256:ef3df6cde80d4914e719188147bef1d71c240edb118340e0c5957ecc8fe08315"}, +] + +[package.dependencies] +defusedxml = ">=0.7,<1.0" +filetype = ">=1.0.10,<1.1.0 || >1.1.0" +pillow-heif = [ + {version = ">=0.10.0,<1.0.0", optional = true, markers = "extra == \"heif\" and python_version < \"3.12\""}, + {version = ">=0.13.0,<1.0.0", optional = true, markers = "extra == \"heif\" and python_version >= \"3.12\""}, +] + +[package.extras] +docs = ["Sphinx (>=7.0)", "sphinx-wagtail-theme (>=6.1.1,<7.0)", "sphinx_copybutton (>=0.5)", "sphinxcontrib-spelling (>=8.0,<9.0)"] +heif = ["pillow-heif (>=0.10.0,<1.0.0)", "pillow-heif (>=0.13.0,<1.0.0)"] +pillow = ["Pillow (>=9.1.0,<11.0.0)"] +testing = ["coverage[toml] (>=7.2.7,<8.0)", "pre-commit (>=3.4.0)", "willow[heif,pillow,wand]"] +wand = ["Wand (>=0.6,<1.0)"] + [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "2ec1949d144e1f275f61034eb080ed853f1b05c82480f013cdb64011c105dd20" +content-hash = "f78737ba67dd46ba18d8f716b34445d76317ab5a479d39d9d1976d7b18149911" diff --git a/pyproject.toml b/pyproject.toml index d0213b4..6659aff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ django-import-export = "^4.0.3" django-tailwind = "^3.8.0" djangorestframework = "^3.15.2" fontawesomefree = "^6.6.0" +wagtail = "^6.2.1" [tool.poetry.group.development.dependencies] diff --git a/templates/pages/about_page.html b/templates/pages/about_page.html new file mode 100644 index 0000000..bbbbbe2 --- /dev/null +++ b/templates/pages/about_page.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} +{% load wagtailcore_tags %} + + +{% block content %} +
+
+

+ {{ page.title }} +

+ +
+ {# Left Column (2/3) #} +
+ {{ page.body|richtext }} +
+ + {# Right Column (1/3) #} + +
+
+
+{% endblock %} From 49ed8098e2cdb18326330877d4f2454aedd7a0e5 Mon Sep 17 00:00:00 2001 From: Jason Heppler Date: Tue, 27 Aug 2024 16:18:18 -0500 Subject: [PATCH 2/6] refactor: Update location country field to allow null values --- .../migrations/0099_alter_location_country.py | 19 ++++++++++++++++ templates/base.html | 22 +++---------------- 2 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 manuscript/migrations/0099_alter_location_country.py diff --git a/manuscript/migrations/0099_alter_location_country.py b/manuscript/migrations/0099_alter_location_country.py new file mode 100644 index 0000000..7e91e59 --- /dev/null +++ b/manuscript/migrations/0099_alter_location_country.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.2 on 2024-08-27 19:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("manuscript", "0098_linecode_associated_folio"), + ] + + operations = [ + migrations.AlterField( + model_name="location", + name="country", + field=models.CharField( + blank=True, max_length=255, null=True, verbose_name="Modern location" + ), + ), + ] diff --git a/templates/base.html b/templates/base.html index 85ea869..cc61c71 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,4 +1,5 @@ {% load static tailwind_tags i18n %} +{% load wagtailcore_tags %} @@ -54,15 +55,7 @@

The La Sfera Project

·
  • - - +
  • @@ -132,17 +125,8 @@

    The La Sfera Project

    ·
  • - - +
  • - From d1f0accaab33689e4c543bc047fcbdfe84a7474d Mon Sep 17 00:00:00 2001 From: Jason Heppler Date: Thu, 29 Aug 2024 10:45:46 -0500 Subject: [PATCH 3/6] refactor: Rearrange installed apps in settings.py --- config/settings.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/config/settings.py b/config/settings.py index 6856b0a..f349f54 100644 --- a/config/settings.py +++ b/config/settings.py @@ -39,17 +39,10 @@ # Application definition INSTALLED_APPS = [ - "admin_interface", - "colorfield", - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.messages", - "prose", - "django_prose_editor", - "allauth", - "allauth.account", - "allauth.socialaccount", - "wagtail.contrib.forms", + "accounts", + "manuscript", + "map", + "pages", "wagtail.contrib.redirects", "wagtail.embeds", "wagtail.sites", @@ -62,6 +55,16 @@ "wagtail", "modelcluster", "taggit", + "admin_interface", + "colorfield", + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.messages", + "prose", + "django_prose_editor", + "allauth", + "allauth.account", + "allauth.socialaccount", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.staticfiles", @@ -72,10 +75,6 @@ "django_browser_reload", "import_export", "django_dbml", - "accounts", - "manuscript", - "map", - "pages", ] MIDDLEWARE = [ @@ -195,6 +194,11 @@ MEDIA_ROOT = str(BASE_DIR / "media") MEDIA_URL = "/media/" +ADMINS = [ + ("Jason Heppler", "jheppler@gmu.edu"), +] +MANAGERS = ADMINS + # Wagtail settings WAGTAIL_SITE_NAME = "La Sfera" WAGTAILADMIN_BASE_URL = "https://dev.lasfera.rrchnm.org" @@ -208,6 +212,7 @@ "txt", "xlsx", ] +TAGGIT_CASE_INSENSITIVE = True # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field From d6bcae194c7a63623400001c55cdd5fc10d7124b Mon Sep 17 00:00:00 2001 From: Jason Heppler Date: Thu, 29 Aug 2024 10:46:04 -0500 Subject: [PATCH 4/6] refactor: Remove unused code for AboutPage and views.py --- config/urls.py | 4 ++-- pages/urls.py | 8 -------- pages/views.py | 14 -------------- 3 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 pages/urls.py delete mode 100644 pages/views.py diff --git a/config/urls.py b/config/urls.py index 72846f0..4999afb 100644 --- a/config/urls.py +++ b/config/urls.py @@ -1,3 +1,5 @@ +import os.path + from django.conf import settings from django.conf.urls.static import static from django.contrib import admin @@ -5,7 +7,6 @@ from django.urls import include, path from wagtail import urls as wagtail_urls from wagtail.admin import urls as wagtailadmin_urls -from wagtail.documents import urls as wagtaildocs_urls urlpatterns = [ path("", include("manuscript.urls")), @@ -16,7 +17,6 @@ path("logout/", auth_views.LogoutView.as_view(), name="logout"), path("prose/", include("prose.urls")), path("cms/", include(wagtailadmin_urls)), - path("documents/", include(wagtaildocs_urls)), path("pages/", include(wagtail_urls)), path("__reload__/", include("django_browser_reload.urls")), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/pages/urls.py b/pages/urls.py deleted file mode 100644 index 4d02e1c..0000000 --- a/pages/urls.py +++ /dev/null @@ -1,8 +0,0 @@ -from django.urls import path - -from pages.models import AboutPage -from pages.views import about - -urlpatterns = [ - # path("about/", about, name="about"), -] diff --git a/pages/views.py b/pages/views.py deleted file mode 100644 index 8cb0bbb..0000000 --- a/pages/views.py +++ /dev/null @@ -1,14 +0,0 @@ -from django.shortcuts import render - -from pages.models import AboutPage - -# def about(request): -# about_page = AboutPage.objects.live().first() - -# return render( -# request, -# "base.html", -# { -# "about_page": about_page, -# }, -# ) From 65ea5f410cbcd20f78a2600d71f83727b50a6c77 Mon Sep 17 00:00:00 2001 From: Jason Heppler Date: Thu, 29 Aug 2024 10:46:09 -0500 Subject: [PATCH 5/6] refactor: Add RoutablePageMixin to AboutPage model --- pages/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/models.py b/pages/models.py index 184acef..a0177be 100644 --- a/pages/models.py +++ b/pages/models.py @@ -1,10 +1,10 @@ -from django.db import models from wagtail.admin.panels import FieldPanel +from wagtail.contrib.routable_page.models import RoutablePageMixin, route from wagtail.fields import RichTextField from wagtail.models import Page -class AboutPage(Page): +class AboutPage(RoutablePageMixin, Page): body = RichTextField(blank=True) team = RichTextField(blank=True) From 43eb29bca793b74e3c82e9b64910bbcf6ac2a053 Mon Sep 17 00:00:00 2001 From: Jason Heppler Date: Thu, 29 Aug 2024 10:46:15 -0500 Subject: [PATCH 6/6] refactor: Update About page links to use absolute URLs --- templates/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/base.html b/templates/base.html index cc61c71..937ae3a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -55,7 +55,7 @@

    The La Sfera Project

    ·
  • - +
  • @@ -125,7 +125,7 @@

    The La Sfera Project

    ·
  • - +