class SessionForm(forms.Form): title = forms.StringField(__("Title"), validators=[forms.validators.DataRequired()]) venue_room_id = forms.SelectField(__("Room"), choices=[], coerce=nullint, validators=[forms.validators.Optional()]) description = forms.MarkdownField(__("Description"), validators=[forms.validators.Optional()]) speaker = forms.StringField(__("Speaker"), validators=[forms.validators.Optional()]) speaker_bio = forms.MarkdownField(__("Speaker bio"), validators=[forms.validators.Optional()]) is_break = forms.BooleanField(__("This session is a break period"), default=False) start = forms.HiddenField(__("Start Time"), validators=[forms.validators.DataRequired()]) end = forms.HiddenField(__("End Time"), validators=[forms.validators.DataRequired()])
class SessionForm(forms.Form): title = forms.StringField( __("Title"), validators=[forms.validators.DataRequired()], filters=[forms.filters.strip()], ) venue_room_id = forms.SelectField(__("Room"), choices=[], coerce=nullint, validators=[forms.validators.Optional()]) description = forms.MarkdownField(__("Description"), validators=[forms.validators.Optional()]) speaker = forms.StringField( __("Speaker"), validators=[ forms.validators.Optional(), forms.validators.Length(max=200) ], filters=[forms.filters.strip()], ) speaker_bio = forms.MarkdownField(__("Speaker bio"), validators=[forms.validators.Optional()]) banner_image_url = forms.URLField( __("Banner image URL"), description=__("From images.hasgeek.com, with 16:9 aspect ratio." " Should be < 50 kB in size"), validators=[ forms.validators.Optional(), forms.validators.Length(max=2000), image_url_validator(), ], ) is_break = forms.BooleanField(__("This session is a break period"), default=False) featured = forms.BooleanField(__("This is a featured session"), default=False) start_at = forms.HiddenField(__("Start Time"), validators=[forms.validators.DataRequired()]) end_at = forms.HiddenField(__("End Time"), validators=[forms.validators.DataRequired()]) video_url = forms.StringField( __("Video URL"), description=__("URL of the uploaded video after the session is over"), validators=[ forms.validators.Optional(), forms.validators.ValidUrl(), forms.validators.Length(max=2000), ], )
class VenueRoomForm(forms.Form): title = forms.StringField( __("Name"), description=__("Name of the room"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=250) ], filters=[forms.filters.strip()], ) description = forms.MarkdownField( __("Description"), description=__("An optional note about the room")) bgcolor = forms.StringField( __("Room colour"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=6) ], description=__( "RGB colour for the room. Enter without the '#'. E.g. CCCCCC."), default="CCCCCC", ) def validate_bgcolor(self, field): if not valid_color_re.match(field.data): raise forms.ValidationError("Please enter a valid color code")
class CfpForm(forms.Form): instructions = forms.MarkdownField( __("Proposal guidelines"), validators=[forms.validators.DataRequired()], default='', description=__( "Set guidelines for the type of sessions" "(talks, workshops, other format) your project is accepting, " "your review process and any other info for participants" ), ) cfp_start_at = forms.DateTimeField( __("Proposal submissions open at"), validators=[forms.validators.Optional()], naive=False, ) cfp_end_at = forms.DateTimeField( __("Proposal submissions close at"), validators=[ forms.validators.Optional(), forms.validators.AllowedIf( 'cfp_start_at', message=__("This requires open time for submissions to be specified"), ), forms.validators.GreaterThanEqualTo( 'cfp_start_at', __("Submissions cannot close before they open") ), ], naive=False, )
class ProposalSpaceForm(forms.Form): name = forms.StringField(__("URL name"), validators=[forms.validators.DataRequired(), forms.ValidName(), AvailableName()]) title = forms.StringField(__("Title"), validators=[forms.validators.DataRequired()]) datelocation = forms.StringField(__("Date and Location"), validators=[forms.validators.DataRequired(), forms.validators.Length(max=50)]) date = forms.DateField(__("Start date (for sorting)"), validators=[forms.validators.DataRequired(__("Enter a valid date in YYYY-MM-DD format"))]) date_upto = forms.DateField(__("End date (for sorting)"), validators=[forms.validators.DataRequired(__("Enter a valid date in YYYY-MM-DD format"))]) tagline = forms.StringField(__("Tagline"), validators=[forms.validators.DataRequired()], description=__("This is displayed on the card on the homepage")) website = forms.URLField(__("Website"), validators=[forms.validators.Optional()]) description = forms.MarkdownField(__("Description"), validators=[forms.validators.DataRequired()], description=__("About Event")) timezone = forms.SelectField(__("Timezone"), description=__("The timezone in which this event occurs"), validators=[forms.validators.DataRequired()], choices=sorted_timezones(), default=u'UTC') bg_image = forms.URLField(__("Background image URL"), description=u"Background image for the mobile app", validators=[forms.validators.Optional()]) bg_color = forms.StringField(__("Background color"), description=__("RGB color for the event, shown on the mobile app. Enter without the '#'. E.g. CCCCCC."), validators=[forms.validators.Optional(), forms.validators.Length(max=6)], default=u"CCCCCC") explore_url = forms.URLField(__("Explore tab URL"), description=__(u"Page containing the explore tab’s contents, for the mobile app"), validators=[forms.validators.Optional()]) parent_space = QuerySelectField(__(u"Parent space"), get_label='title', allow_blank=True, blank_text=__(u"None")) status = forms.SelectField(__("Status"), coerce=int, choices=[ (0, __("Draft")), (1, __("Open")), (2, __("Voting")), (3, __("Jury selection")), (4, __("Feedback")), (5, __("Closed")), (6, __("Withdrawn")), ], description=__(u"Proposals can only be submitted in the “Open” state. " u"“Closed” and “Withdrawn” are hidden from homepage")) admin_team = QuerySelectField(u"Admin Team", validators=[forms.validators.DataRequired(__(u"Please select a team"))], query_factory=profile_teams, get_label='title', allow_blank=False, description=__(u"The administrators of this proposal space")) review_team = QuerySelectField(u"Review Team", validators=[forms.validators.DataRequired(__(u"Please select a team"))], query_factory=profile_teams, get_label='title', allow_blank=False, description=__(u"Reviewers can see contact details of proposers, but can’t change settings")) allow_rsvp = forms.BooleanField(__("Allow site visitors to RSVP (login required)")) buy_tickets_url = forms.URLField(__("URL to buy tickets"), description=__(u"Eg: Explara, Instamojo"), validators=[forms.validators.Optional()]) def validate_date_upto(self, date_upto): if self.date_upto.data < self.date.data: raise forms.ValidationError(_("End date cannot be before start date")) def validate_bg_color(self, field): if not valid_color_re.match(field.data): raise forms.ValidationError("Please enter a valid color code")
class ProjectForm(forms.Form): title = forms.StringField( __("Title"), validators=[forms.validators.DataRequired()], filters=[forms.filters.strip()], ) tagline = forms.StringField( __("Tagline"), validators=[forms.validators.DataRequired(), forms.validators.Length(max=250)], filters=[forms.filters.strip()], description=__("One line description of the project"), ) location = forms.StringField( __("Location"), description=__( '“Online” if this is online-only, else the city or region (without quotes)' ), validators=[ forms.validators.DataRequired( __("If this project is online-only, use “Online”") ), forms.validators.Length( min=3, max=50, message=__("%(max)d characters maximum") ), ], filters=[forms.filters.strip()], ) timezone = forms.SelectField( __("Timezone"), description=__("The timezone in which this event occurs"), validators=[forms.validators.DataRequired()], choices=sorted_timezones(), default='UTC', ) bg_image = forms.URLField( __("Banner image URL"), description=( "From images.hasgeek.com, with 16:9 aspect ratio." " Should be < 100 kB in size" ), validators=[ forms.validators.Optional(), forms.validators.Length(max=2000), image_url_validator(), ], ) description = forms.MarkdownField( __("Project description"), validators=[forms.validators.DataRequired()], description=__("Landing page contents"), ) def validate_location(self, field): if re.search(double_quote_re, field.data) is not None: raise forms.ValidationError( __("Quotes are not necessary in the location name") )
class CommentForm(forms.Form): parent_id = forms.HiddenField(__("Parent"), default="", id="comment_parent_id") comment_edit_id = forms.HiddenField(__("Edit"), default="", id="comment_edit_id") message = forms.MarkdownField(__("Comment"), id="comment_message", validators=[forms.validators.DataRequired()])
class EditProfileForm(forms.Form): """ Edit a profile. """ description = forms.MarkdownField(u"Welcome message", validators=[forms.validators.DataRequired(_(u"Please write a message for the landing page"))], description=_(u"This welcome message will be shown on the landing page.")) admin_team = QuerySelectField(u"Admin Team", validators=[forms.validators.DataRequired(_(u"Please select a team"))], query_factory=profile_teams, get_label='title', allow_blank=False, description=_(u"The team of users with administrative rights to this Talkfunnel (owners always have admin access)"))
class OrderRefundForm(forms.Form): amount = forms.IntegerField( __("Amount"), validators=[ forms.validators.DataRequired(__("Please specify an amount")) ], ) internal_note = forms.StringField( __("Internal note"), validators=[ forms.validators.DataRequired( __("Please specify a note for future reference")), forms.validators.Length(max=250), ], description=__("Add a note for future reference"), filters=[forms.filters.none_if_empty()], ) refund_description = forms.StringField( __("Refund description"), validators=[ forms.validators.DataRequired( __("Please specify a description for the invoice")), forms.validators.Length(max=250), ], description=__("Description for the invoice"), filters=[forms.filters.none_if_empty()], ) note_to_user = forms.MarkdownField( __("Note to user"), validators=[ forms.validators.DataRequired( __("Please specify a note for the buyer")) ], description=__("Send this note to the buyer"), filters=[forms.filters.none_if_empty()], ) def validate_amount(self, field): requested_refund_amount = field.data order = self.edit_parent if not order.paid_amount: raise StopValidation( __("Refunds can only be issued for paid orders")) if (order.refunded_amount + requested_refund_amount) > order.paid_amount: raise StopValidation( __("Invalid refund amount! Must be lesser than {amount}, the net amount paid for the order" .format(amount=order.net_amount)))
class VenueForm(forms.Form): title = forms.StringField(__("Name"), description=__("Name of the venue"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=250) ]) description = forms.MarkdownField( __("Description"), description=__("An optional note about the venue")) address1 = forms.StringField(__("Address (line 1)"), validators=[ forms.validators.Optional(), forms.validators.Length(max=160) ]) address2 = forms.StringField(__("Address (line 2)"), validators=[ forms.validators.Optional(), forms.validators.Length(max=160) ]) city = forms.StringField(__("City"), validators=[ forms.validators.Optional(), forms.validators.Length(max=30) ]) state = forms.StringField(__("State"), validators=[ forms.validators.Optional(), forms.validators.Length(max=30) ]) postcode = forms.StringField(__("Post code"), validators=[ forms.validators.Optional(), forms.validators.Length(max=20) ]) country = forms.SelectField(__("Country"), validators=[ forms.validators.Optional(), forms.validators.Length(max=2) ], choices=country_codes, default="IN") location = forms.CoordinatesField(__("Location"), validators=[ forms.validators.Optional(), forms.validators.ValidCoordinates() ])
class UpdateForm(forms.Form): title = forms.StringField( __("Title"), validators=[forms.validators.DataRequired()], filters=[forms.filters.strip()], ) body = forms.MarkdownField( __("Content"), validators=[forms.validators.DataRequired()], description=__("Markdown formatting is supported"), ) is_pinned = forms.BooleanField( __("Pin this update above other updates"), default=False ) is_restricted = forms.BooleanField( __("Limit visibility to participants only"), default=False )
class ProfileForm(OrganizationForm): """Edit a profile.""" description = forms.MarkdownField( __("Welcome message"), validators=[ forms.validators.DataRequired( _("Please write a message for the profile page")) ], description=__("This message will be shown on the profile page"), ) logo_url = forms.URLField( __("Profile image URL"), description=__("From images.hasgeek.com, with 1:1 aspect ratio." " Should be < 30 kB in size"), validators=[ forms.validators.Optional(), forms.validators.Length(max=2000), image_url_validator(), ], ) website = forms.URLField( __("Website URL"), validators=[ forms.validators.Optional(), forms.validators.Length(max=2000), forms.validators.URL(), forms.validators.ValidUrl(), ], filters=[forms.filters.none_if_empty()], ) def make_for_user(self): self.title.label.text = __("Your name") self.title.description = __( "Your full name, in the form others can recognise you by") self.name.description = __( "A short name for mentioning you with @username, and the URL to your" " profile page. Single word containing letters, numbers and dashes only." " Pick something permanent: changing it will break existing links from" " around the web") self.description.label.text = __("About you") self.description.description = __( "This message will be shown on the profile page")
class RefundTransactionForm(forms.Form): amount = forms.IntegerField(__("Amount"), validators=[ forms.validators.DataRequired( __("Please specify an amount")) ]) internal_note = forms.StringField( __("Internal note"), validators=[forms.validators.Length(max=250)], description=__("Add a note for future reference"), filters=[forms.filters.none_if_empty()]) refund_description = forms.StringField( __("Refund description"), validators=[forms.validators.Length(max=250)], description=__("Why is this order receiving a refund?"), filters=[forms.filters.none_if_empty()]) note_to_user = forms.MarkdownField( __("Note to user"), description=__("Send this note to the buyer"), filters=[forms.filters.none_if_empty()])
class VenueForm(forms.Form): title = forms.StringField( __("Name"), description=__("Name of the venue"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=250) ], filters=[forms.filters.strip()], ) description = forms.MarkdownField( __("Description"), description=__("An optional note about the venue")) address1 = forms.StringField( __("Address (line 1)"), validators=[ forms.validators.Optional(), forms.validators.Length(max=160) ], filters=[forms.filters.strip()], ) address2 = forms.StringField( __("Address (line 2)"), validators=[ forms.validators.Optional(), forms.validators.Length(max=160) ], filters=[forms.filters.strip()], ) city = forms.StringField( __("City"), validators=[ forms.validators.Optional(), forms.validators.Length(max=30) ], filters=[forms.filters.strip()], ) state = forms.StringField( __("State"), validators=[ forms.validators.Optional(), forms.validators.Length(max=30) ], filters=[forms.filters.strip()], ) postcode = forms.StringField( __("Post code"), validators=[ forms.validators.Optional(), forms.validators.Length(max=20) ], filters=[forms.filters.strip()], ) country = forms.SelectField( __("Country"), validators=[ forms.validators.Optional(), forms.validators.Length(max=2) ], choices=[], default='IN', ) coordinates = forms.CoordinatesField( __("Location"), description=__("Pick a location on the map"), validators=[ forms.validators.Optional(), forms.validators.ValidCoordinates() ], ) def set_queries(self): pycountry_locale = gettext.translation( 'iso3166-2', pycountry.LOCALES_DIR, languages=[str(get_locale()), 'en']) countries = [(pycountry_locale.gettext(country.name), country.alpha_2) for country in pycountry.countries] countries.sort() self.country.choices = [(code, name) for (name, code) in countries]
class CommentForm(forms.Form): message = forms.MarkdownField( "", id="comment_message", validators=[forms.validators.DataRequired()], )
class ProposalForm(forms.Form): speaking = forms.RadioField( __("Are you speaking?"), coerce=int, choices=[(1, __(u"I will be speaking")), (0, __(u"I’m proposing a topic for someone to speak on"))]) title = forms.StringField(__("Title"), validators=[forms.validators.DataRequired()], description=__("The title of your session")) section = QuerySelectField(__("Section"), get_label='title', validators=[forms.validators.DataRequired()], widget=forms.ListWidget(prefix_label=False), option_widget=forms.RadioInput()) objective = forms.MarkdownField( __("Objective"), validators=[forms.validators.DataRequired()], description=__( "What is the expected benefit for someone attending this?")) session_type = forms.RadioField( __("Session type"), validators=[forms.validators.DataRequired()], choices=[ ('Lecture', __("Lecture")), ('Demo', __("Demo")), ('Tutorial', __("Tutorial")), ('Workshop', __("Workshop")), ('Discussion', __("Discussion")), ('Panel', __("Panel")), ]) technical_level = forms.RadioField( __("Technical level"), validators=[forms.validators.DataRequired()], choices=[ ('Beginner', __("Beginner")), ('Intermediate', __("Intermediate")), ('Advanced', __("Advanced")), ]) description = forms.MarkdownField( __("Description"), validators=[forms.validators.DataRequired()], description=__("A detailed description of the session")) requirements = forms.MarkdownField( __("Requirements"), description=__( "For workshops, what must participants bring to the session?")) slides = forms.URLField( __("Slides"), validators=[forms.validators.Optional(), forms.validators.URL()], description=__( "Link to your slides. These can be just an outline initially. " "If you provide a Slideshare/Speakerdeck link, we'll embed slides in the page" )) preview_video = forms.URLField( __("Preview Video"), validators=[forms.validators.Optional(), forms.validators.URL()], description=__( "Link to your preview video. Use a video to engage the community and give them a better idea about what you are planning to cover in your session and why they should attend. " "If you provide a YouTube/Vimeo link, we'll embed it in the page")) links = forms.TextAreaField( __("Links"), description=__( "Other links, one per line. Provide links to your profile and " "slides and videos from your previous sessions; anything that'll help " "folks decide if they want to attend your session")) bio = forms.MarkdownField( __("Speaker bio"), validators=[forms.validators.DataRequired()], description=__( "Tell us why you are the best person to be taking this session")) email = forms.EmailField(__("Your email address"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=80) ], description=__( "An email address we can contact you at. " "Not displayed anywhere")) phone = forms.StringField( __("Phone number"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=80) ], description=__( "A phone number we can call you at to discuss your proposal, if required. " "Will not be displayed")) location = forms.StringField( __("Your location"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=80) ], description=__( "Your location, to help plan for your travel if required"))
class ProposalForm(forms.Form): speaking = forms.RadioField( __("Are you speaking?"), coerce=int, choices=[ (1, __("I will be speaking")), (0, __("I’m proposing a topic for someone to speak on")), ], ) title = forms.StringField( __("Title"), validators=[forms.validators.DataRequired()], filters=[forms.filters.strip()], description=__("The title of your session"), ) abstract = forms.MarkdownField( __("Abstract"), validators=[forms.validators.DataRequired()], description=__( "A brief description of your session with target audience and key takeaways" ), ) outline = forms.MarkdownField( __("Outline"), validators=[forms.validators.DataRequired()], description=__( "A detailed description of the session with the sequence of ideas to be presented" ), ) requirements = forms.MarkdownField( __("Requirements"), description=__( "For workshops, what must participants bring to the session?"), ) slides = forms.URLField( __("Slides"), validators=[ forms.validators.Optional(), forms.validators.URL(), forms.validators.ValidUrl(), ], description=__( "Link to your slides. These can be just an outline initially. " "If you provide a Slideshare/Speakerdeck link, we'll embed slides in the page" ), ) video_url = forms.URLField( __("Preview Video"), validators=[ forms.validators.Optional(), forms.validators.URL(), forms.validators.ValidUrl(), ], description=__( "Link to your preview video. Use a video to engage the community and give them a better " "idea about what you are planning to cover in your session and why they should attend. " "If you provide a YouTube/Vimeo link, we'll embed it in the page"), ) links = forms.TextAreaField( __("Links"), description=__( "Other links, one per line. Provide links to your profile and " "slides and videos from your previous sessions; anything that'll help " "folks decide if they want to attend your session"), ) bio = forms.MarkdownField( __("Speaker bio"), validators=[forms.validators.DataRequired()], description=__( "Tell us why you are the best person to be taking this session"), ) email = forms.EmailField( __("Your email address"), validators=[ forms.validators.DataRequired(), EmailAddressAvailable(purpose='use'), ], description=__( "An email address we can contact you at. Not displayed anywhere"), ) phone = forms.StringField( __("Phone number"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=80) ], description=__( "A phone number we can call you at to discuss your proposal, if required. " "Will not be displayed"), ) location = forms.StringField( __("Your location"), validators=[ forms.validators.DataRequired(), forms.validators.Length(max=80) ], description=__( "Your location, to help plan for your travel if required"), ) formlabels = forms.FormField(forms.Form, __("Labels")) def set_queries(self): label_form = proposal_label_form(project=self.edit_parent, proposal=self.edit_obj) if label_form is not None: self.formlabels.form = label_form else: del self.formlabels