ソースを参照

Story #424 Remove Social Media Settings (#482)

Jeremy Childers 2 年 前
コミット
201e18ea3a

+ 16 - 0
coderedcms/migrations/0025_delete_socialmediasettings.py

@@ -0,0 +1,16 @@
+# Generated by Django 3.2.13 on 2022-05-11 21:27
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('coderedcms', '0024_analyticssettings'),
+    ]
+
+    operations = [
+        migrations.DeleteModel(
+            name='SocialMediaSettings',
+        ),
+    ]

+ 0 - 79
coderedcms/models/wagtailsettings_models.py

@@ -4,7 +4,6 @@ Settings are user-configurable on a per-site basis (multisite).
 Global project or developer settings should be defined in coderedcms.settings.py .
 """
 
-import json
 from django.db import models
 from django.utils.translation import gettext_lazy as _
 from wagtail.admin.edit_handlers import FieldPanel, HelpPanel, MultiFieldPanel
@@ -16,84 +15,6 @@ from coderedcms.fields import MonospaceField
 from coderedcms.settings import cr_settings
 
 
-@register_setting(icon='fa-facebook-official')
-class SocialMediaSettings(BaseSetting):
-    """
-    Social media accounts.
-    """
-    class Meta:
-        verbose_name = _('Social Media')
-
-    facebook = models.URLField(
-        blank=True,
-        verbose_name=_('Facebook'),
-        help_text=_('Your Facebook page URL'),
-    )
-    twitter = models.URLField(
-        blank=True,
-        verbose_name=_('Twitter'),
-        help_text=_('Your Twitter page URL'),
-    )
-    instagram = models.CharField(
-        max_length=255,
-        blank=True,
-        verbose_name=_('Instagram'),
-        help_text=_('Your Instagram username, without the @'),
-    )
-    youtube = models.URLField(
-        blank=True,
-        verbose_name=_('YouTube'),
-        help_text=_('Your YouTube channel or user account URL'),
-    )
-    linkedin = models.URLField(
-        blank=True,
-        verbose_name=_('LinkedIn'),
-        help_text=_('Your LinkedIn page URL'),
-    )
-    googleplus = models.URLField(
-        blank=True,
-        verbose_name=_('Google'),
-        help_text=_('Your Google+ page or Google business listing URL'),
-    )
-
-    @property
-    def twitter_handle(self):
-        """
-        Gets the handle of the twitter account from a URL.
-        """
-        return self.twitter.strip().strip('/').split('/')[-1]
-
-    @property
-    def social_json(self):
-        """
-        Returns non-blank social accounts as a JSON list.
-        """
-        socialist = [
-            self.facebook,
-            self.twitter,
-            self.instagram,
-            self.youtube,
-            self.linkedin,
-            self.googleplus,
-        ]
-        socialist = list(filter(None, socialist))
-        return json.dumps(socialist)
-
-    panels = [
-        MultiFieldPanel(
-            [
-                FieldPanel('facebook'),
-                FieldPanel('twitter'),
-                FieldPanel('instagram'),
-                FieldPanel('youtube'),
-                FieldPanel('linkedin'),
-                FieldPanel('googleplus'),
-            ],
-            _('Social Media Accounts'),
-        )
-    ]
-
-
 @register_setting(icon='fa-desktop')
 class LayoutSettings(BaseSetting):
     """

+ 1 - 1
coderedcms/project_template/basic/website/migrations/0001_initial.py

@@ -27,7 +27,7 @@ class Migration(migrations.Migration):
 
     dependencies = [
         migrations.swappable_dependency(settings.AUTH_USER_MODEL),
-        ('coderedcms', '0024_analyticssettings'),
+        ('coderedcms', '0025_delete_socialmediasettings'),
         ('wagtailcore', '0062_comment_models_and_pagesubscription'),
     ]
 

+ 1 - 1
coderedcms/project_template/sass/website/migrations/0001_initial.py

@@ -27,7 +27,7 @@ class Migration(migrations.Migration):
 
     dependencies = [
         migrations.swappable_dependency(settings.AUTH_USER_MODEL),
-        ('coderedcms', '0024_analyticssettings'),
+        ('coderedcms', '0025_delete_socialmediasettings'),
         ('wagtailcore', '0062_comment_models_and_pagesubscription'),
     ]