From 0727e32b9dd9d365df2e5e1aa297c0d1aa3c4e96 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 19 Nov 2021 18:14:42 -0600 Subject: [PATCH 1/4] WIP: Install django-pattern-library (ERROR!) ``` Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/django/template/utils.py", line 66, in __getitem__ return self._engines[alias] KeyError: 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last): ... File "/usr/local/lib/python3.6/site-packages/markdown/util.py", line 88, in INSTALLED_EXTENSIONS = metadata.entry_points(group='markdown.extensions') TypeError: entry_points() got an unexpected keyword argument 'group' ``` --- requirements.txt | 1 + taccsite_cms/settings.py | 30 ++++++++++++++++++++++++++++++ taccsite_cms/urls.py | 7 +++++++ 3 files changed, 38 insertions(+) diff --git a/requirements.txt b/requirements.txt index cfdcea514..7e13b644b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,6 +22,7 @@ django-js-asset==1.2.2 django-meta==1.7.0 django-mptt==0.11.0 django-parler==2.2 +django-pattern-library==0.5.0 django-polymorphic==3.0.0 django-sekizai==2.0.0 django-settings-export==1.2.1 diff --git a/taccsite_cms/settings.py b/taccsite_cms/settings.py index 91b2dea69..f89470307 100644 --- a/taccsite_cms/settings.py +++ b/taccsite_cms/settings.py @@ -224,6 +224,9 @@ def gettext(s): return s 'cms.context_processors.cms_settings', 'django_settings_export.settings_export' ], + 'builtins': [ + 'pattern_library.loader_tags' + ], 'libraries': { # NOTE: These are an unnecessary alternative config, because taccsite_cms is in INSTALLED_APPS, but are comfortably explicit # SEE: https://docs.djangoproject.com/en/3.1/howto/custom-template-tags/#code-layout @@ -297,6 +300,7 @@ def gettext(s): return s 'djangocms_bootstrap4.contrib.bootstrap4_picture', 'djangocms_bootstrap4.contrib.bootstrap4_tabs', 'djangocms_bootstrap4.contrib.bootstrap4_utilities', + 'pattern_library', 'haystack', 'aldryn_apphooks_config', 'test_without_migrations', @@ -423,6 +427,28 @@ def get_subdirs_as_module_names(path): FEATURES = '' +PATTERN_LIBRARY = { + # Groups of templates for the pattern library navigation. + # - The keys are group titles + # - The values are lists of template name prefixes + # (that will be searched to populate the groups) + 'SECTIONS': ( + ('components', ['patterns/components']), + ('pages', ['patterns/pages']), + ), + + # Configure which files to detect as templates. + 'TEMPLATE_SUFFIX': '.html', + + # Set the template inside of which components should be rendered + # (so they may use page-level component dependencies like CSS) + 'PATTERN_BASE_TEMPLATE_NAME': 'patterns/base.html', + + # Any template in BASE_TEMPLATE_NAMES (or any that extends one from there) + # is considered a "page" and will be rendered as-is (without being wrapped) + 'BASE_TEMPLATE_NAMES': ['patterns/base_page.html'], +} + try: from taccsite_cms.settings_custom import * except: @@ -441,6 +467,10 @@ def get_subdirs_as_module_names(path): None # do nothing +######################## +# EXPORT +######################## + SETTINGS_EXPORT = [ 'DEBUG', 'FEATURES', diff --git a/taccsite_cms/urls.py b/taccsite_cms/urls.py index 85f9a4092..9dac4a154 100755 --- a/taccsite_cms/urls.py +++ b/taccsite_cms/urls.py @@ -2,6 +2,7 @@ from __future__ import absolute_import, print_function, unicode_literals from cms.sitemaps import CMSSitemap +from django.apps import apps from django.conf import settings from django.conf.urls.static import static from django.conf.urls import include, url @@ -10,6 +11,7 @@ from django.contrib.sitemaps.views import sitemap from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.static import serve +from django.urls import path from taccsite_cms import remote_cms_auth as remote_cms_auth from django.http import request @@ -39,6 +41,11 @@ url(r'^', include('cms.urls')), ] +# if apps.is_installed("pattern_library"): +urlpatterns += [ + path("pattern-library/", include("pattern_library.urls")), +] + # This is only needed when using runserver. if settings.DEBUG: urlpatterns += [ From 9d250751bc000bfcf6d71ca166c46263891b3e30 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Fri, 19 Nov 2021 18:21:40 -0600 Subject: [PATCH 2/4] WIP: Move settings from Core-CMS to "-Resources (same error as last commit, 0727e32) --- taccsite_cms/settings.py | 26 -------------------------- taccsite_cms/urls.py | 8 ++++---- taccsite_custom | 2 +- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/taccsite_cms/settings.py b/taccsite_cms/settings.py index f89470307..b542aad17 100644 --- a/taccsite_cms/settings.py +++ b/taccsite_cms/settings.py @@ -224,9 +224,6 @@ def gettext(s): return s 'cms.context_processors.cms_settings', 'django_settings_export.settings_export' ], - 'builtins': [ - 'pattern_library.loader_tags' - ], 'libraries': { # NOTE: These are an unnecessary alternative config, because taccsite_cms is in INSTALLED_APPS, but are comfortably explicit # SEE: https://docs.djangoproject.com/en/3.1/howto/custom-template-tags/#code-layout @@ -300,7 +297,6 @@ def gettext(s): return s 'djangocms_bootstrap4.contrib.bootstrap4_picture', 'djangocms_bootstrap4.contrib.bootstrap4_tabs', 'djangocms_bootstrap4.contrib.bootstrap4_utilities', - 'pattern_library', 'haystack', 'aldryn_apphooks_config', 'test_without_migrations', @@ -427,28 +423,6 @@ def get_subdirs_as_module_names(path): FEATURES = '' -PATTERN_LIBRARY = { - # Groups of templates for the pattern library navigation. - # - The keys are group titles - # - The values are lists of template name prefixes - # (that will be searched to populate the groups) - 'SECTIONS': ( - ('components', ['patterns/components']), - ('pages', ['patterns/pages']), - ), - - # Configure which files to detect as templates. - 'TEMPLATE_SUFFIX': '.html', - - # Set the template inside of which components should be rendered - # (so they may use page-level component dependencies like CSS) - 'PATTERN_BASE_TEMPLATE_NAME': 'patterns/base.html', - - # Any template in BASE_TEMPLATE_NAMES (or any that extends one from there) - # is considered a "page" and will be rendered as-is (without being wrapped) - 'BASE_TEMPLATE_NAMES': ['patterns/base_page.html'], -} - try: from taccsite_cms.settings_custom import * except: diff --git a/taccsite_cms/urls.py b/taccsite_cms/urls.py index 9dac4a154..2f8d81a4e 100755 --- a/taccsite_cms/urls.py +++ b/taccsite_cms/urls.py @@ -41,10 +41,10 @@ url(r'^', include('cms.urls')), ] -# if apps.is_installed("pattern_library"): -urlpatterns += [ - path("pattern-library/", include("pattern_library.urls")), -] +if apps.is_installed("pattern_library"): + urlpatterns += [ + path("pattern-library/", include("pattern_library.urls")), + ] # This is only needed when using runserver. if settings.DEBUG: diff --git a/taccsite_custom b/taccsite_custom index 28193dade..3453df2f0 160000 --- a/taccsite_custom +++ b/taccsite_custom @@ -1 +1 @@ -Subproject commit 28193dadeb55ca243b172a85621bc935d7a6ee38 +Subproject commit 3453df2f02d5ebd9da4a8c8c952498979802624d From 75de9b982d4463f79d255db5f74b8f3ed5d06edc Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Thu, 3 Feb 2022 18:09:51 -0600 Subject: [PATCH 3/4] Major: Django Pattern Library w/ Test Content --- taccsite_cms/templates/patterns/base.html | 14 ++++++++++++++ taccsite_cms/templates/patterns/base_page.html | 3 +++ .../components/quote_block/quote_block.html | 8 ++++++++ .../components/quote_block/quote_block.yaml | 4 ++++ .../patterns/pages/test_page/test_page.html | 3 +++ .../patterns/pages/test_page/test_page.yaml | 11 +++++++++++ taccsite_cms/urls.py | 5 ----- taccsite_custom | 2 +- 8 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 taccsite_cms/templates/patterns/base.html create mode 100644 taccsite_cms/templates/patterns/base_page.html create mode 100644 taccsite_cms/templates/patterns/components/quote_block/quote_block.html create mode 100644 taccsite_cms/templates/patterns/components/quote_block/quote_block.yaml create mode 100644 taccsite_cms/templates/patterns/pages/test_page/test_page.html create mode 100644 taccsite_cms/templates/patterns/pages/test_page/test_page.yaml diff --git a/taccsite_cms/templates/patterns/base.html b/taccsite_cms/templates/patterns/base.html new file mode 100644 index 000000000..b117ccd5e --- /dev/null +++ b/taccsite_cms/templates/patterns/base.html @@ -0,0 +1,14 @@ + + + + + + Component Base + + + {% block content %} + {# pattern_library_rendered_pattern is where the pattern library will inject the rendered pattern. #} + {{ pattern_library_rendered_pattern }} + {% endblock %} + + diff --git a/taccsite_cms/templates/patterns/base_page.html b/taccsite_cms/templates/patterns/base_page.html new file mode 100644 index 000000000..52a1cfe59 --- /dev/null +++ b/taccsite_cms/templates/patterns/base_page.html @@ -0,0 +1,3 @@ +{% extends 'patterns/base.html' %} + +{% block title %}Page{% endblock %} diff --git a/taccsite_cms/templates/patterns/components/quote_block/quote_block.html b/taccsite_cms/templates/patterns/components/quote_block/quote_block.html new file mode 100644 index 000000000..b07c94629 --- /dev/null +++ b/taccsite_cms/templates/patterns/components/quote_block/quote_block.html @@ -0,0 +1,8 @@ +
+
+

{{ quote }}

+ {% if attribution %} +

{{ attribution }}

+ {% endif %} +
+
diff --git a/taccsite_cms/templates/patterns/components/quote_block/quote_block.yaml b/taccsite_cms/templates/patterns/components/quote_block/quote_block.yaml new file mode 100644 index 000000000..ab4a99605 --- /dev/null +++ b/taccsite_cms/templates/patterns/components/quote_block/quote_block.yaml @@ -0,0 +1,4 @@ +name: Quote Block (Sample) +context: + quote: What is love? + attribution: Haddaway diff --git a/taccsite_cms/templates/patterns/pages/test_page/test_page.html b/taccsite_cms/templates/patterns/pages/test_page/test_page.html new file mode 100644 index 000000000..5264f1008 --- /dev/null +++ b/taccsite_cms/templates/patterns/pages/test_page/test_page.html @@ -0,0 +1,3 @@ +{% extends 'patterns/base_page.html' %} + +{% block content %}{{ page.body }}{% endblock %} diff --git a/taccsite_cms/templates/patterns/pages/test_page/test_page.yaml b/taccsite_cms/templates/patterns/pages/test_page/test_page.yaml new file mode 100644 index 000000000..9b8ba8fae --- /dev/null +++ b/taccsite_cms/templates/patterns/pages/test_page/test_page.yaml @@ -0,0 +1,11 @@ +context: + page: + body: > +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat + non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +

diff --git a/taccsite_cms/urls.py b/taccsite_cms/urls.py index 2f8d81a4e..aacab1efe 100755 --- a/taccsite_cms/urls.py +++ b/taccsite_cms/urls.py @@ -41,11 +41,6 @@ url(r'^', include('cms.urls')), ] -if apps.is_installed("pattern_library"): - urlpatterns += [ - path("pattern-library/", include("pattern_library.urls")), - ] - # This is only needed when using runserver. if settings.DEBUG: urlpatterns += [ diff --git a/taccsite_custom b/taccsite_custom index 4536556dc..1470154f0 160000 --- a/taccsite_custom +++ b/taccsite_custom @@ -1 +1 @@ -Subproject commit 4536556dc3682cc5a95a543c7aafbe7f8807f9f1 +Subproject commit 1470154f05cd61b61d446a8db693708245d700d4 From 8cbb79c3fed154f51e287fa9707c6f828cf1cf70 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Sun, 24 Apr 2022 19:48:25 -0500 Subject: [PATCH 4/4] chore(submod): update w/ main (no changes) --- taccsite_custom | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taccsite_custom b/taccsite_custom index 68ad0b61b..781802091 160000 --- a/taccsite_custom +++ b/taccsite_custom @@ -1 +1 @@ -Subproject commit 68ad0b61b85740dced736854debd3005ae2531ca +Subproject commit 781802091258325357b0686ff4ad05db960cf1f5