add venues
This commit is contained in:
@ -27,6 +27,7 @@ INSTALLED_APPS = [
|
||||
"home",
|
||||
"associations",
|
||||
"events",
|
||||
"venues",
|
||||
"grapple",
|
||||
"graphene_django",
|
||||
"wagtail.contrib.forms",
|
||||
@ -174,6 +175,6 @@ BASE_URL = "http://example.com"
|
||||
# GraphQL
|
||||
GRAPHENE = {"SCHEMA": "grapple.schema.schema"}
|
||||
GRAPPLE = {
|
||||
"APPS": ["home", "associations", "events"],
|
||||
"APPS": ["home", "associations", "events", "venues"],
|
||||
"EXPOSE_GRAPHIQL": True,
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ from wagtail.models import Page
|
||||
class EventIndex(Page):
|
||||
# there can only be one event index page
|
||||
max_count = 1
|
||||
|
||||
subpage_types = ["events.EventPage"]
|
||||
graphql_fields = []
|
||||
|
||||
|
||||
|
38
dnscms/poetry.lock
generated
38
dnscms/poetry.lock
generated
@ -742,28 +742,28 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.3.7"
|
||||
version = "0.4.4"
|
||||
description = "An extremely fast Python linter and code formatter, written in Rust."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:0e8377cccb2f07abd25e84fc5b2cbe48eeb0fea9f1719cad7caedb061d70e5ce"},
|
||||
{file = "ruff-0.3.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:15a4d1cc1e64e556fa0d67bfd388fed416b7f3b26d5d1c3e7d192c897e39ba4b"},
|
||||
{file = "ruff-0.3.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d28bdf3d7dc71dd46929fafeec98ba89b7c3550c3f0978e36389b5631b793663"},
|
||||
{file = "ruff-0.3.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:379b67d4f49774ba679593b232dcd90d9e10f04d96e3c8ce4a28037ae473f7bb"},
|
||||
{file = "ruff-0.3.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c060aea8ad5ef21cdfbbe05475ab5104ce7827b639a78dd55383a6e9895b7c51"},
|
||||
{file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:ebf8f615dde968272d70502c083ebf963b6781aacd3079081e03b32adfe4d58a"},
|
||||
{file = "ruff-0.3.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d48098bd8f5c38897b03604f5428901b65e3c97d40b3952e38637b5404b739a2"},
|
||||
{file = "ruff-0.3.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da8a4fda219bf9024692b1bc68c9cff4b80507879ada8769dc7e985755d662ea"},
|
||||
{file = "ruff-0.3.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c44e0149f1d8b48c4d5c33d88c677a4aa22fd09b1683d6a7ff55b816b5d074f"},
|
||||
{file = "ruff-0.3.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3050ec0af72b709a62ecc2aca941b9cd479a7bf2b36cc4562f0033d688e44fa1"},
|
||||
{file = "ruff-0.3.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a29cc38e4c1ab00da18a3f6777f8b50099d73326981bb7d182e54a9a21bb4ff7"},
|
||||
{file = "ruff-0.3.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5b15cc59c19edca917f51b1956637db47e200b0fc5e6e1878233d3a938384b0b"},
|
||||
{file = "ruff-0.3.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e491045781b1e38b72c91247cf4634f040f8d0cb3e6d3d64d38dcf43616650b4"},
|
||||
{file = "ruff-0.3.7-py3-none-win32.whl", hash = "sha256:bc931de87593d64fad3a22e201e55ad76271f1d5bfc44e1a1887edd0903c7d9f"},
|
||||
{file = "ruff-0.3.7-py3-none-win_amd64.whl", hash = "sha256:5ef0e501e1e39f35e03c2acb1d1238c595b8bb36cf7a170e7c1df1b73da00e74"},
|
||||
{file = "ruff-0.3.7-py3-none-win_arm64.whl", hash = "sha256:789e144f6dc7019d1f92a812891c645274ed08af6037d11fc65fcbc183b7d59f"},
|
||||
{file = "ruff-0.3.7.tar.gz", hash = "sha256:d5c1aebee5162c2226784800ae031f660c350e7a3402c4d1f8ea4e97e232e3ba"},
|
||||
{file = "ruff-0.4.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:29d44ef5bb6a08e235c8249294fa8d431adc1426bfda99ed493119e6f9ea1bf6"},
|
||||
{file = "ruff-0.4.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:c4efe62b5bbb24178c950732ddd40712b878a9b96b1d02b0ff0b08a090cbd891"},
|
||||
{file = "ruff-0.4.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4c8e2f1e8fc12d07ab521a9005d68a969e167b589cbcaee354cb61e9d9de9c15"},
|
||||
{file = "ruff-0.4.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:60ed88b636a463214905c002fa3eaab19795679ed55529f91e488db3fe8976ab"},
|
||||
{file = "ruff-0.4.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b90fc5e170fc71c712cc4d9ab0e24ea505c6a9e4ebf346787a67e691dfb72e85"},
|
||||
{file = "ruff-0.4.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:8e7e6ebc10ef16dcdc77fd5557ee60647512b400e4a60bdc4849468f076f6eef"},
|
||||
{file = "ruff-0.4.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b9ddb2c494fb79fc208cd15ffe08f32b7682519e067413dbaf5f4b01a6087bcd"},
|
||||
{file = "ruff-0.4.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c51c928a14f9f0a871082603e25a1588059b7e08a920f2f9fa7157b5bf08cfe9"},
|
||||
{file = "ruff-0.4.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b5eb0a4bfd6400b7d07c09a7725e1a98c3b838be557fee229ac0f84d9aa49c36"},
|
||||
{file = "ruff-0.4.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b1867ee9bf3acc21778dcb293db504692eda5f7a11a6e6cc40890182a9f9e595"},
|
||||
{file = "ruff-0.4.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1aecced1269481ef2894cc495647392a34b0bf3e28ff53ed95a385b13aa45768"},
|
||||
{file = "ruff-0.4.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9da73eb616b3241a307b837f32756dc20a0b07e2bcb694fec73699c93d04a69e"},
|
||||
{file = "ruff-0.4.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:958b4ea5589706a81065e2a776237de2ecc3e763342e5cc8e02a4a4d8a5e6f95"},
|
||||
{file = "ruff-0.4.4-py3-none-win32.whl", hash = "sha256:cb53473849f011bca6e754f2cdf47cafc9c4f4ff4570003a0dad0b9b6890e876"},
|
||||
{file = "ruff-0.4.4-py3-none-win_amd64.whl", hash = "sha256:424e5b72597482543b684c11def82669cc6b395aa8cc69acc1858b5ef3e5daae"},
|
||||
{file = "ruff-0.4.4-py3-none-win_arm64.whl", hash = "sha256:39df0537b47d3b597293edbb95baf54ff5b49589eb7ff41926d8243caa995ea6"},
|
||||
{file = "ruff-0.4.4.tar.gz", hash = "sha256:f87ea42d5cdebdc6a69761a9d0bc83ae9b3b30d0ad78952005ba6568d6c022af"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -953,4 +953,4 @@ wand = ["Wand (>=0.6,<1.0)"]
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.12"
|
||||
content-hash = "064c4bf2cf216d5ae785e65ad7409f0d5f7fff4ce0bca79516fd1a4f756a1137"
|
||||
content-hash = "24cb4c360211d1c02576389f51d3ba863b0da6ef2800e39e716ff4bf1f8f8a16"
|
||||
|
@ -13,7 +13,7 @@ wagtail-grapple = "^0.25.1"
|
||||
psycopg2-binary = "^2.9.9"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
ruff = "^0.3.4"
|
||||
ruff = "*"
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 99
|
||||
|
0
dnscms/venues/__init__.py
Normal file
0
dnscms/venues/__init__.py
Normal file
6
dnscms/venues/apps.py
Normal file
6
dnscms/venues/apps.py
Normal file
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class VenuesConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'venues'
|
42
dnscms/venues/migrations/0001_initial.py
Normal file
42
dnscms/venues/migrations/0001_initial.py
Normal file
@ -0,0 +1,42 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-10 15:31
|
||||
|
||||
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='VenuePage',
|
||||
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()), ('image', wagtail.images.blocks.ImageChooserBlock())])),
|
||||
('show_as_bookable', models.BooleanField(default=True, help_text='Skal lokalet dukke i oversikten over lokaler som leies ut?')),
|
||||
('floor', models.CharField(blank=True, max_length=255)),
|
||||
('preposition', models.CharField(blank=True, help_text='Er man i eller på lokalet?', max_length=255)),
|
||||
('capability_audio', models.CharField(blank=True, max_length=255)),
|
||||
('capability_audio_video', models.CharField(blank=True, max_length=255)),
|
||||
('capability_bar', models.CharField(blank=True, max_length=255)),
|
||||
('capability_lighting', models.CharField(blank=True, max_length=255)),
|
||||
('capacity_legal', models.CharField(blank=True, max_length=255)),
|
||||
('capacity_standing', models.CharField(blank=True, max_length=255)),
|
||||
('capacity_sitting', models.CharField(blank=True, max_length=255)),
|
||||
('featured_image', models.ForeignKey(blank=True, help_text='Bilde av lokalet', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
]
|
25
dnscms/venues/migrations/0002_venueindex.py
Normal file
25
dnscms/venues/migrations/0002_venueindex.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-10 15:32
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('venues', '0001_initial'),
|
||||
('wagtailcore', '0093_uploadedfile'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='VenueIndex',
|
||||
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')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('wagtailcore.page',),
|
||||
),
|
||||
]
|
0
dnscms/venues/migrations/__init__.py
Normal file
0
dnscms/venues/migrations/__init__.py
Normal file
109
dnscms/venues/models.py
Normal file
109
dnscms/venues/models.py
Normal file
@ -0,0 +1,109 @@
|
||||
from django.db import models
|
||||
from grapple.models import GraphQLBoolean, GraphQLImage, GraphQLStreamfield, GraphQLString
|
||||
from wagtail import blocks
|
||||
from wagtail.admin.panels import FieldPanel, FieldRowPanel, MultiFieldPanel
|
||||
from wagtail.fields import StreamField
|
||||
from wagtail.images.blocks import ImageChooserBlock
|
||||
from wagtail.models import Page
|
||||
|
||||
|
||||
class VenueIndex(Page):
|
||||
# there can only be one venue index page
|
||||
max_count = 1
|
||||
subpage_types = ["venues.VenuePage"]
|
||||
graphql_fields = []
|
||||
|
||||
|
||||
class VenuePage(Page):
|
||||
# no children
|
||||
subpage_types = []
|
||||
# should not be able to be shown in menus
|
||||
show_in_menus = False
|
||||
|
||||
featured_image = models.ForeignKey(
|
||||
"wagtailimages.Image",
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="+",
|
||||
help_text=("Bilde av lokalet"),
|
||||
)
|
||||
|
||||
body = StreamField(
|
||||
[
|
||||
("paragraph", blocks.RichTextBlock()),
|
||||
("image", ImageChooserBlock()),
|
||||
]
|
||||
)
|
||||
|
||||
show_as_bookable = models.BooleanField(
|
||||
default=True, help_text="Skal lokalet dukke i oversikten over lokaler som leies ut?"
|
||||
)
|
||||
floor = models.CharField(
|
||||
blank=True,
|
||||
max_length=255,
|
||||
)
|
||||
preposition = models.CharField(
|
||||
blank=True, max_length=255, help_text="Er man i eller på lokalet?"
|
||||
)
|
||||
capability_audio = models.CharField(blank=True, max_length=255)
|
||||
capability_audio_video = models.CharField(blank=True, max_length=255)
|
||||
capability_bar = models.CharField(blank=True, max_length=255)
|
||||
capability_lighting = models.CharField(blank=True, max_length=255)
|
||||
capacity_legal = models.CharField(blank=True, max_length=255)
|
||||
capacity_standing = models.CharField(blank=True, max_length=255)
|
||||
capacity_sitting = models.CharField(blank=True, max_length=255)
|
||||
|
||||
# "used_for": "Konsert, foredrag, fest, debatt, teater",
|
||||
|
||||
capability_panels = [
|
||||
FieldRowPanel(
|
||||
children=[
|
||||
FieldPanel("capability_bar", heading="Bar"),
|
||||
FieldPanel("capability_audio", heading="Lyd"),
|
||||
FieldPanel("capability_lighting", heading="Lys"),
|
||||
FieldPanel("capability_audio_video", heading="A/V"),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
capacity_panels = [
|
||||
FieldRowPanel(
|
||||
children=[
|
||||
FieldPanel("capacity_legal", heading="Branntillatelse for"),
|
||||
FieldPanel("capacity_sitting", heading="Stående"),
|
||||
FieldPanel("capacity_standing", heading="Sittende"),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel("featured_image"),
|
||||
FieldPanel("body"),
|
||||
FieldPanel("floor", heading="Etasje"),
|
||||
FieldPanel("preposition", heading="Preposisjon"),
|
||||
FieldPanel("show_as_bookable", heading="Vis på utleieside"),
|
||||
MultiFieldPanel(
|
||||
heading="Kapabiliteter",
|
||||
children=capability_panels,
|
||||
),
|
||||
MultiFieldPanel(
|
||||
heading="Kapasitet",
|
||||
children=capacity_panels,
|
||||
),
|
||||
]
|
||||
|
||||
graphql_fields = [
|
||||
GraphQLImage("featured_image"),
|
||||
GraphQLStreamfield("body"),
|
||||
GraphQLString("floor"),
|
||||
GraphQLString("preposition"),
|
||||
GraphQLBoolean("show_as_bookable"),
|
||||
GraphQLString("capability_audio"),
|
||||
GraphQLString("capability_audio_video"),
|
||||
GraphQLString("capability_bar"),
|
||||
GraphQLString("capability_lighting"),
|
||||
GraphQLString("capacity_legal"),
|
||||
GraphQLString("capacity_standing"),
|
||||
GraphQLString("capacity_sitting"),
|
||||
]
|
Reference in New Issue
Block a user