From 1acaca3ce6cb8e4b378b4c59b25a5baad4e99bb5 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 14 Jul 2022 22:03:24 +0100 Subject: [PATCH] Add social accounts snippet --- .../common/migrations/0013_onlineaccount.py | 30 +++++++++++++++++++ website/common/models.py | 16 ++++++++++ .../common/onlineaccount_snippet_link.html | 1 + 3 files changed, 47 insertions(+) create mode 100644 website/common/migrations/0013_onlineaccount.py create mode 100644 website/common/templates/common/onlineaccount_snippet_link.html diff --git a/website/common/migrations/0013_onlineaccount.py b/website/common/migrations/0013_onlineaccount.py new file mode 100644 index 0000000..bed3860 --- /dev/null +++ b/website/common/migrations/0013_onlineaccount.py @@ -0,0 +1,30 @@ +# Generated by Django 4.0.5 on 2022-07-14 20:56 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("common", "0012_referrallink_alter_contentpage_body_and_more"), + ] + + operations = [ + migrations.CreateModel( + name="OnlineAccount", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=64, unique=True)), + ("url", models.URLField()), + ("username", models.CharField(max_length=64)), + ], + ), + ] diff --git a/website/common/models.py b/website/common/models.py index aad4997..b005538 100644 --- a/website/common/models.py +++ b/website/common/models.py @@ -123,3 +123,19 @@ class ReferralLink(models.Model): def __str__(self) -> str: return self.name + + +@register_snippet +class OnlineAccount(models.Model): + name = models.CharField(max_length=64, unique=True) + url = models.URLField() + username = models.CharField(max_length=64) + + panels = [ + FieldPanel("name"), + FieldPanel("username"), + FieldPanel("url"), + ] + + def __str__(self) -> str: + return self.name diff --git a/website/common/templates/common/onlineaccount_snippet_link.html b/website/common/templates/common/onlineaccount_snippet_link.html new file mode 100644 index 0000000..01af643 --- /dev/null +++ b/website/common/templates/common/onlineaccount_snippet_link.html @@ -0,0 +1 @@ +