2018-06-03 17:41:49 +00:00
import logging
from django import forms
2018-08-19 16:21:04 +00:00
from django . core . exceptions import ImproperlyConfigured
2018-06-03 17:41:49 +00:00
2020-02-12 12:10:41 +00:00
from . models import EventProposal , EventTrack , SpeakerProposal , Url , UrlType
2018-06-03 17:41:49 +00:00
2018-05-20 16:16:20 +00:00
logger = logging . getLogger ( " bornhack. %s " % __name__ )
2018-06-03 17:41:49 +00:00
class SpeakerProposalForm ( forms . ModelForm ) :
2018-05-20 16:16:20 +00:00
"""
2018-06-03 17:41:49 +00:00
The SpeakerProposalForm . Takes an EventType in __init__ and changes fields accordingly .
2018-05-20 16:16:20 +00:00
"""
2019-06-16 12:32:24 +00:00
2019-06-16 13:57:51 +00:00
email = forms . EmailField (
required = False ,
help_text = " The email of the speaker (defaults to the logged in user if empty). " ,
)
2018-05-20 16:16:20 +00:00
class Meta :
model = SpeakerProposal
2019-06-16 12:32:24 +00:00
fields = [
" name " ,
" email " ,
" biography " ,
" needs_oneday_ticket " ,
" submission_notes " ,
]
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
def __init__ ( self , camp , eventtype = None , * args , * * kwargs ) :
# initialise the form
2018-05-20 16:16:20 +00:00
super ( ) . __init__ ( * args , * * kwargs )
2018-06-03 17:41:49 +00:00
# adapt form based on EventType?
if not eventtype :
return
2018-05-24 08:23:42 +00:00
2019-06-16 12:32:24 +00:00
if eventtype . name == " Debate " :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the name field
2019-06-16 12:32:24 +00:00
self . fields [ " name " ] . label = " Guest Name "
self . fields [
" name "
] . help_text = " The name of a debate guest. Can be a real name or an alias. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the biograpy field
2019-06-16 12:32:24 +00:00
self . fields [ " biography " ] . label = " Guest Biography "
self . fields [ " biography " ] . help_text = " The biography of the guest. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Guest Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this guest. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# no free tickets for workshops
2019-06-16 12:32:24 +00:00
del self . fields [ " needs_oneday_ticket " ]
2018-05-20 16:16:20 +00:00
2019-06-16 12:32:24 +00:00
elif eventtype . name == " Lightning Talk " :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the name field
2019-06-16 12:32:24 +00:00
self . fields [ " name " ] . label = " Speaker Name "
self . fields [
" name "
] . help_text = " The name of the speaker. Can be a real name or an alias. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the biograpy field
2019-06-16 12:32:24 +00:00
self . fields [ " biography " ] . label = " Speaker Biography "
self . fields [ " biography " ] . help_text = " The biography of the speaker. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Speaker Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this speaker. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# no free tickets for lightning talks
2019-06-16 12:32:24 +00:00
del self . fields [ " needs_oneday_ticket " ]
2018-05-20 16:16:20 +00:00
2019-06-16 12:32:24 +00:00
elif eventtype . name == " Music Act " :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the name field
2019-06-16 12:32:24 +00:00
self . fields [ " name " ] . label = " Artist Name "
self . fields [
" name "
] . help_text = " The name of the artist. Can be a real name or artist alias. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the biograpy field
2019-06-16 12:32:24 +00:00
self . fields [ " biography " ] . label = " Artist Description "
self . fields [ " biography " ] . help_text = " The description of the artist. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Artist Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this artist. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# no oneday tickets for music acts
2019-06-16 12:32:24 +00:00
del self . fields [ " needs_oneday_ticket " ]
2018-05-20 16:16:20 +00:00
2019-06-16 12:32:24 +00:00
elif eventtype . name == " Recreational Event " :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the name field
2019-06-16 12:32:24 +00:00
self . fields [ " name " ] . label = " Host Name "
self . fields [
" name "
] . help_text = " The name of the event host. Can be a real name or an alias. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the biograpy field
2019-06-16 12:32:24 +00:00
self . fields [ " biography " ] . label = " Host Biography "
self . fields [ " biography " ] . help_text = " The biography of the host. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Host Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this host. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# no oneday tickets for music acts
2019-06-16 12:32:24 +00:00
del self . fields [ " needs_oneday_ticket " ]
2018-05-20 16:16:20 +00:00
2019-06-16 12:32:24 +00:00
elif eventtype . name == " Talk " :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the name field
2019-06-16 12:32:24 +00:00
self . fields [ " name " ] . label = " Speaker Name "
self . fields [
" name "
] . help_text = " The name of the speaker. Can be a real name or an alias. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the biograpy field
2019-06-16 12:32:24 +00:00
self . fields [ " biography " ] . label = " Speaker Biography "
self . fields [ " biography " ] . help_text = " The biography of the speaker. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Speaker Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this speaker. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2019-06-16 12:32:24 +00:00
elif eventtype . name == " Workshop " :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the name field
2019-06-16 12:32:24 +00:00
self . fields [ " name " ] . label = " Host Name "
self . fields [
" name "
] . help_text = (
" The name of the workshop host. Can be a real name or an alias. "
)
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the biograpy field
2019-06-16 12:32:24 +00:00
self . fields [ " biography " ] . label = " Host Biography "
self . fields [ " biography " ] . help_text = " The biography of the host. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Host Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this host. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# no free tickets for workshops
2019-06-16 12:32:24 +00:00
del self . fields [ " needs_oneday_ticket " ]
2018-05-20 16:16:20 +00:00
2019-06-16 12:32:24 +00:00
elif eventtype . name == " Slacking Off " :
2018-06-23 23:02:06 +00:00
# fix label and help_text for the name field
2019-06-16 12:32:24 +00:00
self . fields [ " name " ] . label = " Host Name "
self . fields [ " name " ] . help_text = " Can be a real name or an alias. "
2018-06-23 23:02:06 +00:00
# fix label and help_text for the biograpy field
2019-06-16 12:32:24 +00:00
self . fields [ " biography " ] . label = " Host Biography "
self . fields [ " biography " ] . help_text = " The biography of the host. "
2018-06-23 23:02:06 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Host Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this host. Only visible to yourself and the BornHack organisers. "
2018-06-23 23:02:06 +00:00
# no free tickets for workshops
2019-06-16 12:32:24 +00:00
del self . fields [ " needs_oneday_ticket " ]
2018-06-23 23:02:06 +00:00
2019-06-16 12:32:24 +00:00
elif eventtype . name == " Meetup " :
2018-08-04 11:54:37 +00:00
# fix label and help_text for the name field
2019-06-16 12:32:24 +00:00
self . fields [ " name " ] . label = " Host Name "
self . fields [
" name "
] . help_text = " The name of the meetup host. Can be a real name or an alias. "
2018-08-04 11:54:37 +00:00
# fix label and help_text for the biograpy field
2019-06-16 12:32:24 +00:00
self . fields [ " biography " ] . label = " Host Biography "
self . fields [ " biography " ] . help_text = " The biography of the host. "
2018-08-04 11:54:37 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Host Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this host. Only visible to yourself and the BornHack organisers. "
2018-08-04 11:54:37 +00:00
# no free tickets for workshops
2019-06-16 12:32:24 +00:00
del self . fields [ " needs_oneday_ticket " ]
2018-08-04 11:54:37 +00:00
2018-06-03 17:41:49 +00:00
else :
2019-06-16 12:32:24 +00:00
raise ImproperlyConfigured (
" Unsupported event type, don ' t know which form class to use "
)
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
class EventProposalForm ( forms . ModelForm ) :
2018-05-20 16:16:20 +00:00
"""
2018-06-03 17:41:49 +00:00
The EventProposalForm . Takes an EventType in __init__ and changes fields accordingly .
2018-05-20 16:16:20 +00:00
"""
2018-08-18 18:43:10 +00:00
slides_url = forms . URLField (
2019-06-16 12:32:24 +00:00
label = " Slides URL " , help_text = " Add a URL to your slides. " , required = False
2018-08-18 18:43:10 +00:00
)
2018-06-03 17:41:49 +00:00
class Meta :
model = EventProposal
2019-06-16 12:32:24 +00:00
fields = [
" title " ,
" abstract " ,
" allow_video_recording " ,
" duration " ,
" slides_url " ,
" submission_notes " ,
" track " ,
2019-07-31 10:47:38 +00:00
" use_provided_speaker_laptop " ,
2019-06-16 12:32:24 +00:00
]
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
def clean_duration ( self ) :
2019-06-16 12:32:24 +00:00
duration = self . cleaned_data [ " duration " ]
2018-06-03 17:41:49 +00:00
if not duration or duration < 60 or duration > 180 :
2019-06-16 12:32:24 +00:00
raise forms . ValidationError (
" Please keep duration between 60 and 180 minutes. "
)
2018-06-03 17:41:49 +00:00
return duration
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
def clean_track ( self ) :
2019-06-16 12:32:24 +00:00
track = self . cleaned_data [ " track " ]
2018-06-03 17:41:49 +00:00
# TODO: make sure the track is part of the current camp, needs camp as form kwarg to verify
return track
2018-05-20 16:16:20 +00:00
2018-08-19 16:21:04 +00:00
def save ( self , commit = True , user = None , event_type = None ) :
eventproposal = super ( ) . save ( commit = False )
if user :
eventproposal . user = user
if event_type :
eventproposal . event_type = event_type
eventproposal . save ( )
2018-08-18 18:43:10 +00:00
2019-06-16 12:32:24 +00:00
if not event_type and hasattr ( eventproposal , " event_type " ) :
2018-08-21 11:47:56 +00:00
event_type = eventproposal . event_type
2018-08-18 18:43:10 +00:00
2019-06-16 12:32:24 +00:00
if self . cleaned_data . get ( " slides_url " ) and event_type . name in [
" Talk " ,
" Lightning Talk " ,
] :
url = self . cleaned_data . get ( " slides_url " )
2018-08-19 16:21:04 +00:00
if not eventproposal . urls . filter ( url = url ) . exists ( ) :
slides_url = Url ( )
slides_url . eventproposal = eventproposal
slides_url . url = url
slides_url . urltype = UrlType . objects . get ( name = " Slides " )
slides_url . save ( )
return eventproposal
2018-06-03 17:41:49 +00:00
def __init__ ( self , camp , eventtype = None , * args , * * kwargs ) :
# initialise form
2018-05-20 16:16:20 +00:00
super ( ) . __init__ ( * args , * * kwargs )
2019-07-31 10:47:38 +00:00
TALK = " Talk "
LIGHTNING_TALK = " Lightning Talk "
DEBATE = " Debate "
MUSIC_ACT = " Music Act "
RECREATIONAL_EVENT = " Recreational Event "
WORKSHOP = " Workshop "
SLACKING_OFF = " Slacking Off "
MEETUP = " Meetup "
2018-06-03 17:41:49 +00:00
# disable the empty_label for the track select box
2019-06-16 12:32:24 +00:00
self . fields [ " track " ] . empty_label = None
self . fields [ " track " ] . queryset = EventTrack . objects . filter ( camp = camp )
2018-05-20 16:16:20 +00:00
2018-08-09 13:35:58 +00:00
# make sure video_recording checkbox defaults to checked
2019-06-16 12:32:24 +00:00
self . fields [ " allow_video_recording " ] . initial = True
2018-08-09 13:35:58 +00:00
2019-07-31 10:47:38 +00:00
if eventtype . name not in [ TALK , LIGHTNING_TALK ] :
2018-08-18 18:43:10 +00:00
# Only talk or lightning talk should show the slides_url field
2019-06-16 12:32:24 +00:00
del self . fields [ " slides_url " ]
2018-08-18 18:43:10 +00:00
2019-07-31 10:47:38 +00:00
if not eventtype . name == LIGHTNING_TALK :
# Only lightning talks submissions will have to choose whether to use provided speaker laptop
del self . fields [ " use_provided_speaker_laptop " ]
if eventtype . name == DEBATE :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the title field
2019-06-16 12:32:24 +00:00
self . fields [ " title " ] . label = " Title of debate "
self . fields [ " title " ] . help_text = " The title of this debate "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the abstract field
2019-06-16 12:32:24 +00:00
self . fields [ " abstract " ] . label = " Description "
self . fields [ " abstract " ] . help_text = " The description of this debate "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Debate Act Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this debate. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# better placeholder text for duration field
2019-06-16 12:32:24 +00:00
self . fields [ " duration " ] . widget . attrs [
" placeholder "
] = " Debate Duration (minutes) "
2018-05-20 16:16:20 +00:00
2019-07-31 10:47:38 +00:00
elif eventtype . name == MUSIC_ACT :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the title field
2019-06-16 12:32:24 +00:00
self . fields [ " title " ] . label = " Title of music act "
self . fields [ " title " ] . help_text = " The title of this music act/concert/set. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the abstract field
2019-06-16 12:32:24 +00:00
self . fields [ " abstract " ] . label = " Description "
self . fields [ " abstract " ] . help_text = " The description of this music act "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Music Act Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this music act. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# no video recording for music acts
2019-06-16 12:32:24 +00:00
del self . fields [ " allow_video_recording " ]
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# better placeholder text for duration field
2019-06-16 12:32:24 +00:00
self . fields [ " duration " ] . widget . attrs [ " placeholder " ] = " Duration (minutes) "
2018-05-20 16:16:20 +00:00
2019-07-31 10:47:38 +00:00
elif eventtype . name == RECREATIONAL_EVENT :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the title field
2019-06-16 12:32:24 +00:00
self . fields [ " title " ] . label = " Event Title "
self . fields [ " title " ] . help_text = " The title of this recreational event "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the abstract field
2019-06-16 12:32:24 +00:00
self . fields [ " abstract " ] . label = " Event Abstract "
self . fields [
" abstract "
] . help_text = " The description/abstract of this recreational event. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Event Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this recreational event. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# no video recording for music acts
2019-06-16 12:32:24 +00:00
del self . fields [ " allow_video_recording " ]
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# better placeholder text for duration field
2019-06-16 12:32:24 +00:00
self . fields [ " duration " ] . label = " Event Duration "
self . fields [ " duration " ] . widget . attrs [ " placeholder " ] = " Duration (minutes) "
2018-05-20 16:16:20 +00:00
2019-07-31 10:47:38 +00:00
elif eventtype . name in [ TALK , LIGHTNING_TALK ] :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the title field
2019-06-16 12:32:24 +00:00
self . fields [ " title " ] . label = " Title of Talk "
self . fields [ " title " ] . help_text = " The title of this talk/presentation. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the abstract field
2019-06-16 12:32:24 +00:00
self . fields [ " abstract " ] . label = " Abstract of Talk "
self . fields [
" abstract "
] . help_text = " The description/abstract of this talk/presentation. Explain what the audience will experience. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Talk Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this talk. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2019-07-31 10:47:38 +00:00
if self . fields . get ( " slides_url " ) and eventtype . name == LIGHTNING_TALK :
2019-06-16 12:32:24 +00:00
self . fields [
" slides_url "
] . help_text + = " You will only get assigned a slot if you have provided slides (a title slide is enough if you don ' t use slides for the talk). You can add an URL later if need be. "
2018-08-18 18:43:10 +00:00
2018-06-03 17:41:49 +00:00
# no duration for talks
2019-06-16 12:32:24 +00:00
del self . fields [ " duration " ]
2018-05-20 16:16:20 +00:00
2019-07-31 10:47:38 +00:00
elif eventtype . name == WORKSHOP :
2018-06-03 17:41:49 +00:00
# fix label and help_text for the title field
2019-06-16 12:32:24 +00:00
self . fields [ " title " ] . label = " Workshop Title "
self . fields [ " title " ] . help_text = " The title of this workshop. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Workshop Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this workshop. Only visible to yourself and the BornHack organisers. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# fix label and help_text for the abstract field
2019-06-16 12:32:24 +00:00
self . fields [ " abstract " ] . label = " Workshop Abstract "
self . fields [
" abstract "
] . help_text = " The description/abstract of this workshop. Explain what the participants will learn. "
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# no video recording for workshops
2019-06-16 12:32:24 +00:00
del self . fields [ " allow_video_recording " ]
2018-05-20 16:16:20 +00:00
2018-06-03 17:41:49 +00:00
# duration field
2019-06-16 12:32:24 +00:00
self . fields [ " duration " ] . label = " Workshop Duration "
self . fields [
" duration "
] . help_text = " How much time (in minutes) should we set aside for this workshop? Please keep it between 60 and 180 minutes (1-3 hours). "
2018-05-20 16:16:20 +00:00
2019-07-31 10:47:38 +00:00
elif eventtype . name == SLACKING_OFF :
2018-06-26 21:37:39 +00:00
# fix label and help_text for the title field
2019-06-16 12:32:24 +00:00
self . fields [ " title " ] . label = " Event Title "
self . fields [ " title " ] . help_text = " The title of this recreational event. "
2018-06-26 21:37:39 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Event Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this recreational event. Only visible to yourself and the BornHack organisers. "
2018-06-26 21:37:39 +00:00
# fix label and help_text for the abstract field
2019-06-16 12:32:24 +00:00
self . fields [ " abstract " ] . label = " Event Abstract "
self . fields [
" abstract "
] . help_text = " The description/abstract of this event. Explain what the participants will experience. "
2018-06-26 21:37:39 +00:00
# no video recording for recreational events
2019-06-16 12:32:24 +00:00
del self . fields [ " allow_video_recording " ]
2018-06-26 21:37:39 +00:00
# duration field
2019-06-16 12:32:24 +00:00
self . fields [ " duration " ] . label = " Event Duration "
self . fields [
" duration "
] . help_text = " How much time (in minutes) should we set aside for this event? Please keep it between 60 and 180 minutes (1-3 hours). "
2018-06-26 21:37:39 +00:00
2019-07-31 10:47:38 +00:00
elif eventtype . name == MEETUP :
2018-08-04 11:54:37 +00:00
# fix label and help_text for the title field
2019-06-16 12:32:24 +00:00
self . fields [ " title " ] . label = " Meetup Title "
self . fields [ " title " ] . help_text = " The title of this meetup. "
2018-08-04 11:54:37 +00:00
# fix label and help_text for the submission_notes field
2019-06-16 12:32:24 +00:00
self . fields [ " submission_notes " ] . label = " Meetup Notes "
self . fields [
" submission_notes "
] . help_text = " Private notes regarding this meetup. Only visible to yourself and the BornHack organisers. "
2018-08-04 11:54:37 +00:00
# fix label and help_text for the abstract field
2019-06-16 12:32:24 +00:00
self . fields [ " abstract " ] . label = " Meetup Abstract "
self . fields [
" abstract "
] . help_text = " The description/abstract of this meetup. Explain what the meetup is about and who should attend. "
2018-08-04 11:54:37 +00:00
# no video recording for meetups
2019-06-16 12:32:24 +00:00
del self . fields [ " allow_video_recording " ]
2018-08-04 11:54:37 +00:00
# duration field
2019-06-16 12:32:24 +00:00
self . fields [ " duration " ] . label = " Meetup Duration "
self . fields [
" duration "
] . help_text = " How much time (in minutes) should we set aside for this meetup? Please keep it between 60 and 180 minutes (1-3 hours). "
2018-08-04 11:54:37 +00:00
2018-06-03 17:41:49 +00:00
else :
2019-06-16 12:32:24 +00:00
raise ImproperlyConfigured (
" Unsupported event type, don ' t know which form class to use "
)