Add social accounts snippet
This commit is contained in:
parent
72ac1bc1da
commit
1acaca3ce6
3 changed files with 47 additions and 0 deletions
30
website/common/migrations/0013_onlineaccount.py
Normal file
30
website/common/migrations/0013_onlineaccount.py
Normal 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)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<a href="{{ object.url }}">
|
Loading…
Reference in a new issue