@ -156,26 +156,26 @@ class HomePage(Page):
REVOLUTION_SLIDER_FIELDS = [
REVOLUTION_SLIDER_FIELDS = [
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' slide1_img ' ) ,
FieldPanel ( ' slide1_img ' ) ,
FieldPanel ( ' slide1_headline ' , classname = " full " ) ,
FieldPanel ( ' slide1_headline ' ) ,
FieldPanel ( ' slide1_subline ' , classname = " full " ) ,
FieldPanel ( ' slide1_subline ' ) ,
FieldPanel ( ' slide1_link_url ' , classname = " full " ) ,
FieldPanel ( ' slide1_link_url ' ) ,
FieldPanel ( ' slide1_link_text ' , classname = " full " ) ,
FieldPanel ( ' slide1_link_text ' ) ,
] , heading = ' Slide 1 ' , classname = " collapsible " ) ,
] , heading = ' Slide 1 ' , classname = " collapsible " ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' slide2_img ' ) ,
FieldPanel ( ' slide2_img ' ) ,
FieldPanel ( ' slide2_headline ' , classname = " full " ) ,
FieldPanel ( ' slide2_headline ' ) ,
FieldPanel ( ' slide2_subline ' , classname = " full " ) ,
FieldPanel ( ' slide2_subline ' ) ,
FieldPanel ( ' slide2_link_url ' , classname = " full " ) ,
FieldPanel ( ' slide2_link_url ' ) ,
FieldPanel ( ' slide2_link_text ' , classname = " full " ) ,
FieldPanel ( ' slide2_link_text ' ) ,
] , heading = ' Slide 2 ' , classname = " collapsible " ) ,
] , heading = ' Slide 2 ' , classname = " collapsible " ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' slide3_img ' ) ,
FieldPanel ( ' slide3_img ' ) ,
FieldPanel ( ' slide3_headline ' , classname = " full " ) ,
FieldPanel ( ' slide3_headline ' ) ,
FieldPanel ( ' slide3_subline ' , classname = " full " ) ,
FieldPanel ( ' slide3_subline ' ) ,
FieldPanel ( ' slide3_link_url ' , classname = " full " ) ,
FieldPanel ( ' slide3_link_url ' ) ,
FieldPanel ( ' slide3_link_text ' , classname = " full " ) ,
FieldPanel ( ' slide3_link_text ' ) ,
] , heading = ' Slide 3 ' ) ,
] , heading = ' Slide 3 ' ) ,
]
]
@ -183,30 +183,30 @@ HOME_THUMBNAIL_FIELDS = [
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' thumbnail1_img ' ) ,
FieldPanel ( ' thumbnail1_img ' ) ,
PageChooserPanel ( ' thumbnail1_more_page ' ) ,
PageChooserPanel ( ' thumbnail1_more_page ' ) ,
FieldPanel ( ' thumbnail1_more_text ' , classname = " full " ) ,
FieldPanel ( ' thumbnail1_more_text ' ) ,
FieldPanel ( ' thumbnail1_title ' , classname = " full " ) ,
FieldPanel ( ' thumbnail1_title ' ) ,
FieldPanel ( ' thumbnail1_text ' , classname = " full " ) ,
FieldPanel ( ' thumbnail1_text ' ) ,
] , heading = ' Thumbnail 1 ' , classname = " collapsible " ) ,
] , heading = ' Thumbnail 1 ' , classname = " collapsible " ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' thumbnail2_img ' ) ,
FieldPanel ( ' thumbnail2_img ' ) ,
PageChooserPanel ( ' thumbnail2_more_page ' ) ,
PageChooserPanel ( ' thumbnail2_more_page ' ) ,
FieldPanel ( ' thumbnail2_more_text ' , classname = " full " ) ,
FieldPanel ( ' thumbnail2_more_text ' ) ,
FieldPanel ( ' thumbnail2_title ' , classname = " full " ) ,
FieldPanel ( ' thumbnail2_title ' ) ,
FieldPanel ( ' thumbnail2_text ' , classname = " full " ) ,
FieldPanel ( ' thumbnail2_text ' ) ,
] , heading = ' Thumbnail 2 ' , classname = " collapsible " ) ,
] , heading = ' Thumbnail 2 ' , classname = " collapsible " ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' thumbnail3_img ' ) ,
FieldPanel ( ' thumbnail3_img ' ) ,
PageChooserPanel ( ' thumbnail3_more_page ' ) ,
PageChooserPanel ( ' thumbnail3_more_page ' ) ,
FieldPanel ( ' thumbnail3_more_text ' , classname = " full " ) ,
FieldPanel ( ' thumbnail3_more_text ' ) ,
FieldPanel ( ' thumbnail3_title ' , classname = " full " ) ,
FieldPanel ( ' thumbnail3_title ' ) ,
FieldPanel ( ' thumbnail3_text ' , classname = " full " ) ,
FieldPanel ( ' thumbnail3_text ' ) ,
] , heading = ' Thumbnail 3 ' , classname = " collapsible " ) ,
] , heading = ' Thumbnail 3 ' , classname = " collapsible " ) ,
]
]
HomePage . content_panels = [
HomePage . content_panels = [
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' title ' , classname = " full title " ) ,
MultiFieldPanel ( REVOLUTION_SLIDER_FIELDS , heading = ' Slider elements ' , classname = " collapsible collapsed " ) ,
MultiFieldPanel ( REVOLUTION_SLIDER_FIELDS , heading = ' Slider elements ' , classname = " collapsible collapsed " ) ,
FieldPanel ( ' block1 ' , classname = " full " ) ,
FieldPanel ( ' block1 ' ) ,
MultiFieldPanel ( HOME_THUMBNAIL_FIELDS , heading = ' Thumbnail elements ' , classname = " collapsible collapsed " ) ,
MultiFieldPanel ( HOME_THUMBNAIL_FIELDS , heading = ' Thumbnail elements ' , classname = " collapsible collapsed " ) ,
]
]
@ -225,11 +225,16 @@ class SimpleOneColumnPage(Page):
SimpleOneColumnPage . content_panels = [
SimpleOneColumnPage . content_panels = [
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' featured_media ' ) ,
FieldPanel ( ' featured_media ' ) ,
FieldPanel ( ' content ' , classname = " full " ) ,
FieldPanel ( ' content ' ) ,
]
]
class BlogPage ( Page ) :
class BlogPage ( Page ) :
subtitle = models . CharField (
max_length = 512 ,
default = " Aktuelle Neuigkeiten, Einblicke und Ankündigungen " ,
blank = True
)
posts = StreamField ( [
posts = StreamField ( [
( ' post ' , blocks . StructBlock ( [
( ' post ' , blocks . StructBlock ( [
( ' images ' , blocks . ListBlock ( ImageChooserBlock ( ) ) ) ,
( ' images ' , blocks . ListBlock ( ImageChooserBlock ( ) ) ) ,
@ -244,6 +249,7 @@ class BlogPage(Page):
BlogPage . content_panels = [
BlogPage . content_panels = [
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' subtitle ' ) ,
FieldPanel ( ' posts ' ) ,
FieldPanel ( ' posts ' ) ,
]
]
@ -258,7 +264,7 @@ class EventIndexPage(Page):
description = " Displays all events on EventPages below in an overview. Use this as parent page for events. "
description = " Displays all events on EventPages below in an overview. Use this as parent page for events. "
class EventPage ( AbstractEmailForm ) :
class EventPage ( Page ) :
parent_page_types = [ ' core.EventIndexPage ' , ' core.EventHistoryPage ' ]
parent_page_types = [ ' core.EventIndexPage ' , ' core.EventHistoryPage ' ]
subtitle = models . CharField ( max_length = 512 , null = True , blank = True )
subtitle = models . CharField ( max_length = 512 , null = True , blank = True )
description = RichTextField ( blank = True )
description = RichTextField ( blank = True )
@ -358,6 +364,22 @@ class EventPage(AbstractEmailForm):
( ' muted ' , blocks . BooleanBlock ( label = ' Stummgeschaltet starten ' , required = False ) ) ,
( ' muted ' , blocks . BooleanBlock ( label = ' Stummgeschaltet starten ' , required = False ) ) ,
( ' post_content ' , blocks . RichTextBlock ( required = False ) ) ,
( ' post_content ' , blocks . RichTextBlock ( required = False ) ) ,
] ) ) ,
] ) ) ,
( ' image_tab ' , blocks . StructBlock ( [
( ' title ' , blocks . CharBlock ( max_length = 64 ) ) ,
( ' image ' , ImageChooserBlock ( ) ) ,
( ' caption ' , blocks . CharBlock ( max_length = 256 , required = False ) ) ,
( ' size ' , blocks . ChoiceBlock ( choices = [
( ' small ' , ' Small (25 % width) ' ) ,
( ' medium ' , ' Medium (50 % width) ' ) ,
( ' large ' , ' Large (75 % width) ' ) ,
( ' full ' , ' Full width (100 % ) ' ) ,
] , default = ' large ' ) ) ,
( ' alignment ' , blocks . ChoiceBlock ( choices = [
( ' left ' , ' Left ' ) ,
( ' center ' , ' Center ' ) ,
( ' right ' , ' Right ' ) ,
] , default = ' center ' ) ) ,
] ) ) ,
] , null = True , blank = True , use_json_field = True )
] , null = True , blank = True , use_json_field = True )
registration_url = models . URLField ( max_length = 512 , blank = True , help_text = " URL der Anmeldeseite (leer lassen um klassische Anmeldung zu verwenden) " )
registration_url = models . URLField ( max_length = 512 , blank = True , help_text = " URL der Anmeldeseite (leer lassen um klassische Anmeldung zu verwenden) " )
@ -369,11 +391,9 @@ class EventPage(AbstractEmailForm):
help_text = " Last day where the registration will be available. Leave empty to enable registration permanently "
help_text = " Last day where the registration will be available. Leave empty to enable registration permanently "
" after start date " )
" after start date " )
show_in_event_calendar = models . BooleanField ( default = True , help_text = ' Event in Eventliste und im Kalender anzeigen? ' )
show_in_event_calendar = models . BooleanField ( default = True , help_text = ' Event in Eventliste und im Kalender anzeigen? ' )
is_external = models . BooleanField ( default = False , help_text = ' Externes Event? Externe Events werden nicht im Upcoming Events Banner auf der Startseite angezeigt. ' )
is_free = models . BooleanField ( default = False , help_text = ' If this is checked the send button under the registration '
is_free = models . BooleanField ( default = False , help_text = ' If this is checked the send button under the registration '
' form will be labeled " verbindlich anmelden " instead of " kostenpflichtig anmelden " ' )
' form will be labeled " verbindlich anmelden " instead of " kostenpflichtig anmelden " ' )
external_registration_code = models . TextField (
blank = True , null = True ,
help_text = ' Put code e.g. from Xing here. If this field is filled out there will be no registration form displayed. ' )
vimeo_id = models . TextField ( blank = True , help_text = ' Vimeo Event ID (aus Vimeo-Link: https://vimeo.com/<hier-ist-die-id> ) ' )
vimeo_id = models . TextField ( blank = True , help_text = ' Vimeo Event ID (aus Vimeo-Link: https://vimeo.com/<hier-ist-die-id> ) ' )
@ -406,38 +426,32 @@ class EventRegistrationField(AbstractFormField):
EventPage . content_panels = [
EventPage . content_panels = [
MultiFieldPanel ( REVOLUTION_SLIDER_FIELDS , heading = ' Slider elements ' , classname = " collapsible collapsed " ) ,
MultiFieldPanel ( REVOLUTION_SLIDER_FIELDS , heading = ' Slider elements ' , classname = " collapsible collapsed " ) ,
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' subtitle ' , classname = " full " ) ,
FieldPanel ( ' subtitle ' ) ,
FieldPanel ( ' description ' , classname = " full " ) ,
FieldPanel ( ' description ' ) ,
FieldPanel ( ' img1_img ' ) ,
FieldPanel ( ' img1_img ' ) ,
FieldPanel ( ' img1_caption ' , classname = " full " ) ,
FieldPanel ( ' img1_caption ' ) ,
FieldPanel ( ' img2_img ' ) ,
FieldPanel ( ' img2_img ' ) ,
FieldPanel ( ' img2_caption ' , classname = " full " ) ,
FieldPanel ( ' img2_caption ' ) ,
FieldPanel ( ' start_date ' , classname = " full " ) ,
FieldPanel ( ' start_date ' ) ,
FieldPanel ( ' end_date ' , classname = " full " ) ,
FieldPanel ( ' end_date ' ) ,
FieldPanel ( ' tabs ' ) ,
FieldPanel ( ' tabs ' ) ,
FieldPanel ( ' location_name ' , classname = " full " ) ,
FieldPanel ( ' location_name ' ) ,
FieldPanel ( ' location_street ' , classname = " full " ) ,
FieldPanel ( ' location_street ' ) ,
FieldPanel ( ' location_city ' , classname = " full " ) ,
FieldPanel ( ' location_city ' ) ,
FieldPanel ( ' flyer ' ) ,
FieldPanel ( ' flyer ' ) ,
FieldPanel ( ' downloads ' ) ,
FieldPanel ( ' downloads ' ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' show_in_event_calendar ' , classname = " full " ) ,
FieldPanel ( ' show_in_event_calendar ' ) ,
FieldPanel ( ' is_free ' , classname = " full " ) ,
FieldPanel ( ' is_free ' ) ,
FieldPanel ( ' pretix_slug ' , classname = " full " ) ,
FieldPanel ( ' is_external ' ) ,
FieldPanel ( ' registration_url ' , classname = " full " ) ,
FieldPanel ( ' pretix_slug ' ) ,
FieldPanel ( ' vimeo_id ' , classname = " full " ) ,
FieldPanel ( ' registration_url ' ) ,
FieldPanel ( ' vimeo_id ' ) ,
] , heading = " Settings " , classname = " collapsible collapsed " ) ,
] , heading = " Settings " , classname = " collapsible collapsed " ) ,
FieldPanel ( ' external_registration_code ' , classname = " full " ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
InlinePanel ( ' form_fields ' , label = " Form fields " ) ,
FieldPanel ( ' registration_start_date ' ) ,
FieldPanel ( ' registration_start_date ' , classname = " full " ) ,
FieldPanel ( ' registration_end_date ' ) ,
FieldPanel ( ' registration_end_date ' , classname = " full " ) ,
] , heading = " Registration Settings " , classname = " collapsible collapsed " ) ,
MultiFieldPanel ( [
FieldPanel ( ' to_address ' , classname = " full " ) ,
FieldPanel ( ' from_address ' , classname = " full " ) ,
FieldPanel ( ' subject ' , classname = " full " ) ,
] , " Email " ) ,
] , heading = " Registration Form " , classname = " collapsible collapsed " ) ,
]
]
@ -458,6 +472,45 @@ class EventHistoryPage(Page):
] ) ) ,
] ) ) ,
] , null = True , blank = True , use_json_field = True )
] , null = True , blank = True , use_json_field = True )
def get_all_events ( self ) :
"""
Returns a list of all events , including both manual entries from the StreamField
and child EventPage objects , sorted by start_date .
"""
# Get manual entries from StreamField
manual_events = [ ]
for event_block in self . events :
manual_events . append ( {
' type ' : ' manual ' ,
' value ' : event_block . value
} )
# Get child EventPage objects
from core . models import EventPage
child_events = [ ]
for child in self . get_children ( ) . specific ( ) :
if isinstance ( child , EventPage ) :
child_events . append ( {
' type ' : ' page ' ,
' value ' : {
' title ' : child . title ,
' subtitle ' : child . subtitle ,
' start_date ' : child . start_date ,
' end_date ' : child . end_date ,
' location_name ' : child . location_name ,
' location_city ' : child . location_city ,
' image ' : child . img1_img ,
' flyer ' : child . flyer ,
' additional_info_btn_label ' : ' ' ,
' additional_info_target ' : None ,
} ,
' page ' : child
} )
# Combine and sort all events by start_date
all_events = manual_events + child_events
return sorted ( all_events , key = lambda x : x [ ' value ' ] [ ' start_date ' ] , reverse = True )
EventHistoryPage . content_panels = [
EventHistoryPage . content_panels = [
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' title ' , classname = " full title " ) ,
@ -489,20 +542,20 @@ class ContactFormPage(WagtailCaptchaEmailForm):
ContactFormPage . content_panels = [
ContactFormPage . content_panels = [
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' form_title ' , classname = " full " ) ,
FieldPanel ( ' form_title ' ) ,
FieldPanel ( ' person_img ' ) ,
FieldPanel ( ' person_img ' ) ,
FieldPanel ( ' person_name ' , classname = " full " ) ,
FieldPanel ( ' person_name ' ) ,
FieldPanel ( ' person_position ' , classname = " full " ) ,
FieldPanel ( ' person_position ' ) ,
FieldPanel ( ' address ' , classname = " full " ) ,
FieldPanel ( ' address ' ) ,
FieldPanel ( ' mail_address ' , classname = " full " ) ,
FieldPanel ( ' mail_address ' ) ,
FieldPanel ( ' phone ' , classname = " full " ) ,
FieldPanel ( ' phone ' ) ,
FieldPanel ( ' web_address ' , classname = " full " ) ,
FieldPanel ( ' web_address ' ) ,
InlinePanel ( ' form_fields ' , label = " Form fields " ) ,
InlinePanel ( ' form_fields ' , label = " Form fields " ) ,
FieldPanel ( ' thank_you_text ' , classname = " full " ) ,
FieldPanel ( ' thank_you_text ' ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' to_address ' , classname = " full " ) ,
FieldPanel ( ' to_address ' ) ,
FieldPanel ( ' from_address ' , classname = " full " ) ,
FieldPanel ( ' from_address ' ) ,
FieldPanel ( ' subject ' , classname = " full " ) ,
FieldPanel ( ' subject ' ) ,
] , " Email " )
] , " Email " )
]
]
@ -572,21 +625,21 @@ class AboutUsPage(Page):
AboutUsPage . content_panels = [
AboutUsPage . content_panels = [
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' title ' , classname = " full title " ) ,
FieldPanel ( ' company_intro ' , classname = " full " ) ,
FieldPanel ( ' company_intro ' ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' mission_title ' , classname = " full " ) ,
FieldPanel ( ' mission_title ' ) ,
FieldPanel ( ' mission_text ' , classname = " full " ) ,
FieldPanel ( ' mission_text ' ) ,
FieldPanel ( ' vision_title ' , classname = " full " ) ,
FieldPanel ( ' vision_title ' ) ,
FieldPanel ( ' vision_text ' , classname = " full " ) ,
FieldPanel ( ' vision_text ' ) ,
] , heading = " Mission and Vision " , classname = " collapsible " ) ,
] , heading = " Mission and Vision " , classname = " collapsible " ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' history_title ' , classname = " full " ) ,
FieldPanel ( ' history_title ' ) ,
FieldPanel ( ' history_text ' , classname = " full " ) ,
FieldPanel ( ' history_text ' ) ,
] , heading = " Company History " , classname = " collapsible " ) ,
] , heading = " Company History " , classname = " collapsible " ) ,
MultiFieldPanel ( [
MultiFieldPanel ( [
FieldPanel ( ' team_title ' , classname = " full " ) ,
FieldPanel ( ' team_title ' ) ,
FieldPanel ( ' team_intro ' , classname = " full " ) ,
FieldPanel ( ' team_intro ' ) ,
FieldPanel ( ' team_members ' ) ,
FieldPanel ( ' team_members ' ) ,
] , heading = " Team Members " , classname = " collapsible " ) ,
] , heading = " Team Members " , classname = " collapsible " ) ,
FieldPanel ( ' additional_content ' , classname = " full " ) ,
FieldPanel ( ' additional_content ' ) ,
]
]