Browse Source

Pin version of black and run formatters

Jeremy Childers 1 year ago
parent
commit
545d85994b

+ 1 - 0
coderedcms/__init__.py

@@ -14,6 +14,7 @@ Maintains version of coderedcms.
 
 See: https://www.python.org/dev/peps/pep-0440/
 """
+
 release = ["3", "0", "0", "", "dev0"]
 
 

+ 1 - 0
coderedcms/blocks/content_blocks.py

@@ -2,6 +2,7 @@
 Content blocks are for building complex, nested HTML structures that usually
 contain sub-blocks, and may require javascript to function properly.
 """
+
 from django.utils.translation import gettext_lazy as _
 from wagtail import blocks
 from wagtail.documents.blocks import DocumentChooserBlock

+ 1 - 0
coderedcms/blocks/html_blocks.py

@@ -6,6 +6,7 @@ HTML blocks should NOT contain more sub-blocks or sub-streamfields.
 They must be safe to nest within more robust "content blocks" without
 creating recursion.
 """
+
 import logging
 from django.utils.translation import gettext_lazy as _
 from wagtail.contrib.table_block.blocks import TableBlock as WagtailTableBlock

+ 1 - 0
coderedcms/forms.py

@@ -1,6 +1,7 @@
 """
 Enhancements to wagtail.contrib.forms.
 """
+
 import csv
 import os
 from django import forms

+ 1 - 0
coderedcms/importexport.py

@@ -7,6 +7,7 @@ or simply deprecate all of this functionality.
 
 See: https://github.com/torchbox/wagtail-import-export/
 """
+
 import csv
 import copy
 

+ 18 - 20
coderedcms/models/integration_models.py

@@ -31,9 +31,9 @@ class MailchimpSubscriberIntegrationWidget(Input):
         ctx["widget"]["extra_js"] = self.render_js(
             name, list_library, json_value
         )
-        ctx["widget"][
-            "selectable_mailchimp_lists"
-        ] = self.get_selectable_mailchimp_lists(list_library)
+        ctx["widget"]["selectable_mailchimp_lists"] = (
+            self.get_selectable_mailchimp_lists(list_library)
+        )
         ctx["widget"]["stored_mailchimp_list"] = self.get_stored_mailchimp_list(
             json_value
         )
@@ -94,27 +94,25 @@ class MailchimpSubscriberIntegrationWidget(Input):
                     "interest_categories": {},
                 }
 
-                list_library[mlist["id"]][
-                    "merge_fields"
-                ] = mailchimp.get_merge_fields_for_list(mlist["id"])[
-                    "merge_fields"
-                ]
-                list_library[mlist["id"]][
-                    "interest_categories"
-                ] = mailchimp.get_interest_categories_for_list(mlist["id"])[
-                    "categories"
-                ]
+                list_library[mlist["id"]]["merge_fields"] = (
+                    mailchimp.get_merge_fields_for_list(mlist["id"])[
+                        "merge_fields"
+                    ]
+                )
+                list_library[mlist["id"]]["interest_categories"] = (
+                    mailchimp.get_interest_categories_for_list(mlist["id"])[
+                        "categories"
+                    ]
+                )
 
                 for category in list_library[mlist["id"]][
                     "interest_categories"
                 ]:
-                    category[
-                        "interests"
-                    ] = mailchimp.get_interests_for_interest_category(
-                        mlist["id"], category["id"]
-                    )[
-                        "interests"
-                    ]
+                    category["interests"] = (
+                        mailchimp.get_interests_for_interest_category(
+                            mlist["id"], category["id"]
+                        )["interests"]
+                    )
 
         return list_library
 

+ 12 - 10
coderedcms/models/page_models.py

@@ -381,9 +381,9 @@ class CoderedPage(WagtailCacheMixin, SeoMixin, Page, metaclass=CoderedPageMeta):
             "*", []
         ) + crx_settings.CRX_FRONTEND_TEMPLATES_PAGES.get(klassname, [])
 
-        self._meta.get_field(
-            "index_order_by"
-        ).choices = self.index_order_by_choices
+        self._meta.get_field("index_order_by").choices = (
+            self.index_order_by_choices
+        )
         self._meta.get_field("custom_template").choices = template_choices
         if not self.id:
             self.index_order_by = self.index_order_by_default
@@ -1225,9 +1225,11 @@ class CoderedEventIndexPage(CoderedWebPage):
                 event_data = {
                     "title": event.title,
                     "start": local_start.strftime("%Y-%m-%dT%H:%M:%S%z"),
-                    "end": local_end.strftime("%Y-%m-%dT%H:%M:%S%z")
-                    if local_end
-                    else "",
+                    "end": (
+                        local_end.strftime("%Y-%m-%dT%H:%M:%S%z")
+                        if local_end
+                        else ""
+                    ),
                     "description": "",
                 }
                 if event.url:
@@ -1593,10 +1595,10 @@ class CoderedFormMixin(models.Model):
             if isinstance(value, list):
                 dictionary[new_key] = ", ".join(value)
             else:
-                dictionary[
-                    new_key
-                ] = utils.attempt_protected_media_value_conversion(
-                    request, value
+                dictionary[new_key] = (
+                    utils.attempt_protected_media_value_conversion(
+                        request, value
+                    )
                 )
 
         return dictionary

+ 12 - 12
coderedcms/models/wagtailsettings_models.py

@@ -199,18 +199,18 @@ class LayoutSettings(ClusterableModel, BaseSiteSetting):
         """
         super().__init__(*args, **kwargs)
         # Set choices dynamically.
-        self._meta.get_field(
-            "frontend_theme"
-        ).choices = crx_settings.CRX_FRONTEND_THEME_CHOICES
-        self._meta.get_field(
-            "navbar_collapse_mode"
-        ).choices = crx_settings.CRX_FRONTEND_NAVBAR_COLLAPSE_MODE_CHOICES
-        self._meta.get_field(
-            "navbar_color_scheme"
-        ).choices = crx_settings.CRX_FRONTEND_NAVBAR_COLOR_SCHEME_CHOICES
-        self._meta.get_field(
-            "navbar_format"
-        ).choices = crx_settings.CRX_FRONTEND_NAVBAR_FORMAT_CHOICES
+        self._meta.get_field("frontend_theme").choices = (
+            crx_settings.CRX_FRONTEND_THEME_CHOICES
+        )
+        self._meta.get_field("navbar_collapse_mode").choices = (
+            crx_settings.CRX_FRONTEND_NAVBAR_COLLAPSE_MODE_CHOICES
+        )
+        self._meta.get_field("navbar_color_scheme").choices = (
+            crx_settings.CRX_FRONTEND_NAVBAR_COLOR_SCHEME_CHOICES
+        )
+        self._meta.get_field("navbar_format").choices = (
+            crx_settings.CRX_FRONTEND_NAVBAR_FORMAT_CHOICES
+        )
         # Set default dynamically.
         if not self.id:
             self.frontend_theme = crx_settings.CRX_FRONTEND_THEME_DEFAULT

+ 1 - 0
coderedcms/project_template/basic/website/models.py

@@ -1,6 +1,7 @@
 """
 Create or customize your page models here.
 """
+
 from coderedcms.forms import CoderedFormField
 from coderedcms.models import CoderedArticleIndexPage
 from coderedcms.models import CoderedArticlePage

+ 1 - 0
coderedcms/project_template/pro/custom_media/models.py

@@ -3,6 +3,7 @@ Custom overrides of Wagtail Document and Image models. All other
 models related to website content should most likely go in
 ``website.models`` instead.
 """
+
 from django.db import models
 from wagtail.documents.models import AbstractDocument
 from wagtail.documents.models import Document

+ 1 - 0
coderedcms/project_template/pro/website/models.py

@@ -1,6 +1,7 @@
 """
 Create or customize your page models here.
 """
+
 from coderedcms.forms import CoderedFormField
 from coderedcms.models import CoderedArticleIndexPage
 from coderedcms.models import CoderedArticlePage

+ 10 - 5
coderedcms/templates/coderedcms/blocks/film_strip_block.html

@@ -7,11 +7,16 @@
     <div class="row g-0 flex-nowrap" data-block="film-row">
       {% for panel in value.film_panels.all %}
         {% image panel.background_image original as image %}
-        <div data-block="film-panel" class="col-auto col crx-filmstrip-panel {{panel.custom_css_class}}" {% if panel.custom_id %}id="{{panel.custom_id}}"{% endif %} style="
-          {% if image %}background-image: url({{image.url}}); background-size: cover; background-position: center;{% endif %}
-          {% if panel.background_color %}background-color: {{panel.background_color}};{% endif %}
-          {% if panel.foreground_color %}color: {{panel.foreground_color}};{% endif %}
-        ">
+        <div 
+          data-block="film-panel" 
+          class="col-auto col crx-filmstrip-panel {{panel.custom_css_class}}" 
+          {% if panel.custom_id %}id="{{panel.custom_id}}"{% endif %} 
+          style="
+            {% if image %}background-image: url({{image.url}}); background-size: cover; background-position: center;{% endif %}
+            {% if panel.background_color %}background-color: {{panel.background_color}};{% endif %}
+            {% if panel.foreground_color %}color: {{panel.foreground_color}};{% endif %}
+          "
+        >
           {% include_block panel.content %}
         </div>
         {% endfor %}

+ 3 - 3
coderedcms/wagtail_flexible_forms/models.py

@@ -206,9 +206,9 @@ class Steps(list):
     def current(self, new_index: int):
         if not isinstance(new_index, int):
             raise TypeError("Use an integer to set the new current step.")
-        self.request.session[
-            self.page.current_step_session_key
-        ] = self.clamp_index(new_index)
+        self.request.session[self.page.current_step_session_key] = (
+            self.clamp_index(new_index)
+        )
 
     def forward(self, increment: int = 1):
         self.current = self.current_index + increment

+ 1 - 1
requirements-ci.txt

@@ -2,7 +2,7 @@
 -e .
 
 # Requirements, in addition to coderedcms, needed for CI runner.
-black
+black==24.2.0
 codespell
 flake8
 pytest-cov

+ 1 - 0
tutorial/mysite/website/models.py

@@ -1,6 +1,7 @@
 """
 Create or customize your page models here.
 """
+
 from modelcluster.fields import ParentalKey
 from coderedcms.forms import CoderedFormField
 from coderedcms.models import (