ソースを参照

Fix FormSubmission to work with Wagtail 3; resolve django 5 warnings (#509)

Vince Salvino 2 年 前
コミット
d5501eb0c7

+ 2 - 2
coderedcms/models/page_models.py

@@ -36,7 +36,7 @@ from eventtools.models import BaseEvent, BaseOccurrence
 from icalendar import Alarm
 from icalendar import Event as ICalEvent
 from modelcluster.fields import ParentalKey, ParentalManyToManyField
-from modelcluster.tags import ClusterTaggableManager
+from modelcluster.contrib.taggit import ClusterTaggableManager
 from pathlib import Path
 from taggit.models import TaggedItemBase
 from wagtail.admin.panels import (
@@ -1435,7 +1435,7 @@ class CoderedFormMixin(models.Model):
         if form.is_valid():
             processed_data = self.process_data(form, request)
             form_submission = self.get_submission_class()(
-                form_data=json.dumps(processed_data, cls=self.encoder),
+                form_data=processed_data,
                 page=self,
             )
             self.process_form_submission(

+ 11 - 2
coderedcms/models/tests/test_page_models.py

@@ -98,10 +98,19 @@ class ConcreteFormPageTestCase(ConcreteBasicPageTestCase):
 
     def test_post(self):
         """
-        Tests to make sure a basic version of the page serves a 200 from a POST request.
+        Tests to make sure a basic version of the page accepts data and is
+        viewable in the Wagtail admin.
         """
-        response = self.client.post(self.basic_page.url, follow=True)
+        # TODO: add form field via streamfield.
+        response = self.client.post(
+            self.basic_page.url,
+            {
+                'name': 'Monty Python'
+            },
+            follow=True
+        )
         self.assertEqual(response.status_code, 200)
+        # TODO: log in as superuser and get wagtail admin form submission page.
 
     def test_spam(self):
         """

+ 0 - 2
coderedcms/project_template/basic/project_name/settings/base.py

@@ -151,8 +151,6 @@ TIME_ZONE = 'America/New_York'
 
 USE_I18N = True
 
-USE_L10N = True
-
 USE_TZ = True
 
 

+ 0 - 2
coderedcms/project_template/sass/project_name/settings/base.py

@@ -146,8 +146,6 @@ TIME_ZONE = 'America/New_York'
 
 USE_I18N = False
 
-USE_L10N = True
-
 USE_TZ = True
 
 

+ 0 - 2
coderedcms/tests/settings.py

@@ -149,8 +149,6 @@ TIME_ZONE = 'America/New_York'
 
 USE_I18N = True
 
-USE_L10N = True
-
 USE_TZ = True
 
 

+ 0 - 2
tutorial/mysite/mysite/settings/base.py

@@ -150,8 +150,6 @@ TIME_ZONE = 'America/New_York'
 
 USE_I18N = True
 
-USE_L10N = True
-
 USE_TZ = True