add event organizer models, changes to associations
This commit is contained in:
@ -0,0 +1,38 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-13 02:15
|
||||
|
||||
import django.db.models.deletion
|
||||
import wagtail.blocks
|
||||
import wagtail.fields
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('associations', '0001_initial'),
|
||||
('wagtailcore', '0093_uploadedfile'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='AssociationIndex',
|
||||
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([('paragraph', wagtail.blocks.RichTextBlock())])),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='association',
|
||||
old_name='url',
|
||||
new_name='websiteUrl',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='association',
|
||||
name='body',
|
||||
field=wagtail.fields.StreamField([('paragraph', wagtail.blocks.RichTextBlock())]),
|
||||
),
|
||||
]
|
@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-13 02:21
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('associations', '0002_associationindex_rename_url_association_websiteurl_and_more'),
|
||||
('wagtailcore', '0093_uploadedfile'),
|
||||
('wagtailimages', '0026_delete_uploadedimage'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameModel(
|
||||
old_name='Association',
|
||||
new_name='AssociationPage',
|
||||
),
|
||||
]
|
@ -1,23 +1,37 @@
|
||||
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
|
||||
from wagtail.fields import StreamField
|
||||
from wagtail.models import Page
|
||||
|
||||
|
||||
class Association(Page):
|
||||
class AssociationIndex(Page):
|
||||
max_count = 1
|
||||
subpage_types = ["associations.AssociationPage"]
|
||||
|
||||
body = StreamField(
|
||||
[
|
||||
("paragraph", blocks.RichTextBlock()),
|
||||
]
|
||||
)
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel("body"),
|
||||
]
|
||||
|
||||
|
||||
class AssociationPage(Page):
|
||||
subpage_types = []
|
||||
parent_page_types = ["associations.AssociationIndex"]
|
||||
show_in_menus = False
|
||||
|
||||
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(
|
||||
@ -30,13 +44,11 @@ class Association(Page):
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="+",
|
||||
)
|
||||
url = models.URLField()
|
||||
websiteUrl = models.URLField()
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
# FieldPanel('author'),
|
||||
# FieldPanel('date'),
|
||||
FieldPanel("body"),
|
||||
FieldPanel("logo"),
|
||||
FieldPanel("association_type"),
|
||||
FieldPanel("url"),
|
||||
FieldPanel("association_type", heading="Type"),
|
||||
FieldPanel("websiteUrl", heading="Nettside"),
|
||||
]
|
||||
|
Reference in New Issue
Block a user