Skip to content
Snippets Groups Projects
Commit ac9a4a98 authored by Alexa Valentová's avatar Alexa Valentová
Browse files

finish migrating people group blocks

parent 61502f41
Branches
No related tags found
2 merge requests!1025Migrate people group blocks,!1024Clean up blocks, migrate PeopleGroupBlock design
Pipeline #18744 passed
......@@ -147,6 +147,7 @@ class PeopleGroupBlock(StructBlock):
class Meta:
icon = "group"
label = "Slug skupiny"
template = "styleguide2/includes/organisms/cards/people_card_list.html"
def get_prep_value(self, value):
value = super().get_prep_value(value)
......
......@@ -7,11 +7,17 @@ import wagtail.contrib.table_block.blocks
import wagtail.fields
import wagtail.images.blocks
import wagtailmetadata.models
from django.apps import apps as base_apps
from django.contrib.contenttypes.management import create_contenttypes
from django.db import migrations, models
 
import shared.models
 
 
def update_contenttypes(apps, schema_editor):
create_contenttypes(base_apps.get_app_config("district"))
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0023_add_choose_permissions"),
......@@ -15005,4 +15011,5 @@ class Migration(migrations.Migration):
migrations.DeleteModel(
name="DistrictElectionPointPage",
),
migrations.RunPython(update_contenttypes),
]
......@@ -4,12 +4,7 @@ import wagtail
from django.apps import apps as base_apps
from django.contrib.contenttypes.management import create_contenttypes
from django.db import migrations, transaction
from wagtail.blocks import (
CharBlock,
RichTextBlock,
StreamBlock,
StructBlock,
)
from wagtail.blocks import CharBlock, RichTextBlock, StreamBlock, StructBlock
from district.blocks import (
CandidateListBlock,
......@@ -93,6 +88,7 @@ def migrate_programs(apps, schema_editor):
ContentType = apps.get_model("contenttypes", "ContentType")
try:
root_page_content_type = ContentType.objects.get(
app_label="district", model="districtelectionrootpage"
)
......@@ -114,6 +110,10 @@ def migrate_programs(apps, schema_editor):
new_program_page_content_type = ContentType.objects.get(
app_label="district", model="districtnewprogrampage"
)
except ContentType.DoesNotExist:
# This is a fresh instance and old models don't need to be migrated.
# Not beautiful, but shouldn't cause any trouble.
return
# Function to get children of a certain type
def get_children_of_type(model, parent_page, content_type):
......
This diff is collapsed.
{% load wagtailimages_tags %}
<h1 class="head-9xl my-8">{{ self.title }}</h1>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 w-full my-8">
{% if self.person_list %}
{% for person_page in self.person_list %}
{% image person_page.profile_image fill-480x480 as profile_image %}
{% include 'styleguide2/includes/molecules/contact/contact_person_large_box.html' with image=profile_image name=person_page.title function=person_page.position telephone=person_page.phone mail=person_page.email url=person_page.url %}
{% endfor %}
{% elif self.person_list_with_custom_positions %}
{% for person in self.person_list_with_custom_positions %}
{% with person.page as person_page %}
{% image person_page.profile_image fill-480x480 as profile_image %}
{% firstof person.position person_page.position as position %}
{% include 'styleguide2/includes/molecules/contact/contact_person_large_box.html' with image=profile_image name=person_page.title function=position telephone=person_page.phone mail=person_page.email url=person_page.url %}
{% endwith %}
{% endfor %}
{% endif %}
</div>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment