Move accounts snippet to new contact app

This commit is contained in:
Jake Howard 2022-07-20 08:57:19 +01:00
parent 675d3f38b9
commit 9b7a2b2c21
Signed by: jake
GPG Key ID: 57AFB45680EDD477
8 changed files with 66 additions and 16 deletions

View File

@ -0,0 +1,16 @@
# Generated by Django 4.0.5 on 2022-07-20 07:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("common", "0015_alter_contentpage_body_alter_listingpage_body"),
]
operations = [
migrations.DeleteModel(
name="OnlineAccount",
),
]

View File

@ -123,19 +123,3 @@ 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

View File

@ -0,0 +1,30 @@
# Generated by Django 4.0.5 on 2022-07-20 07:52
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [] # type: ignore
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

19
website/contact/models.py Normal file
View File

@ -0,0 +1,19 @@
from django.db import models
from wagtail.admin.panels import FieldPanel
from wagtail.snippets.models import register_snippet
@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

@ -28,6 +28,7 @@ INSTALLED_APPS = [
"website.search",
"website.blog",
"website.images",
"website.contact",
"website.contrib.code_block",
"website.contrib.mermaid_block",
"website.contrib.unsplash",