Add social accounts snippet

This commit is contained in:
Jake Howard 2022-07-14 22:03:24 +01:00
parent 72ac1bc1da
commit 1acaca3ce6
Signed by: jake
GPG Key ID: 57AFB45680EDD477
3 changed files with 47 additions and 0 deletions

View File

@ -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)),
],
),
]

View File

@ -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

View File

@ -0,0 +1 @@
<a href="{{ object.url }}">