add skeleton for dnscms
This commit is contained in:
0
dnscms/associations/__init__.py
Normal file
0
dnscms/associations/__init__.py
Normal file
6
dnscms/associations/apps.py
Normal file
6
dnscms/associations/apps.py
Normal file
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class AssociationsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'associations'
|
34
dnscms/associations/migrations/0001_initial.py
Normal file
34
dnscms/associations/migrations/0001_initial.py
Normal 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',),
|
||||
),
|
||||
]
|
0
dnscms/associations/migrations/__init__.py
Normal file
0
dnscms/associations/migrations/__init__.py
Normal file
42
dnscms/associations/models.py
Normal file
42
dnscms/associations/models.py
Normal 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"),
|
||||
]
|
3
dnscms/associations/tests.py
Normal file
3
dnscms/associations/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
dnscms/associations/views.py
Normal file
3
dnscms/associations/views.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Reference in New Issue
Block a user