add skeleton for dnscms

This commit is contained in:
2024-05-07 01:41:37 +02:00
parent bd5e205ab0
commit 86b6d77bf1
49 changed files with 2158 additions and 0 deletions

View File

View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class AssociationsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'associations'

View File

@ -0,0 +1,34 @@
# Generated by Django 5.0.4 on 2024-05-04 03:35
import django.db.models.deletion
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0093_uploadedfile'),
('wagtailimages', '0026_delete_uploadedimage'),
]
operations = [
migrations.CreateModel(
name='Association',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('body', wagtail.fields.StreamField([('heading', wagtail.blocks.CharBlock(form_classname='title')), ('paragraph', wagtail.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock())])),
('association_type', models.CharField(choices=[('forening', 'Forening'), ('utvalg', 'Utvalg')], default='forening', max_length=64)),
('url', models.URLField()),
('logo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
]

View File

@ -0,0 +1,42 @@
from django.db import models
from wagtail.models import Page
from wagtail.fields import StreamField
from wagtail import blocks
from wagtail.admin.panels import FieldPanel
from wagtail.images.blocks import ImageChooserBlock
class Association(Page):
class AssociationType(models.TextChoices):
FORENING = "forening", "Forening"
UTVALG = "utvalg", "Utvalg"
body = StreamField(
[
("heading", blocks.CharBlock(form_classname="title")),
("paragraph", blocks.RichTextBlock()),
("image", ImageChooserBlock()),
]
)
association_type = models.CharField(
max_length=64, choices=AssociationType, default=AssociationType.FORENING
)
logo = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
)
url = models.URLField()
content_panels = Page.content_panels + [
# FieldPanel('author'),
# FieldPanel('date'),
FieldPanel("body"),
FieldPanel("logo"),
FieldPanel("association_type"),
FieldPanel("url"),
]

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.