class SubmitStuff(FlaskForm): entrydate = DateTimeField('Date (YYYY-MM-DD)', format='%Y-%m-%d') submit = SubmitField('Show Me')
class LostForm(Form): title = TextField('What did you find?', validators = [validators.DataRequired(), validators.length(10)]) date = DateTimeField('When did you find it?', validators = [validators.DataRequired()]) email = TextField('Enter your email.', validators = [validators.DataRequired(), validators.Email()]) image = FileField('Upload a picture.', validators = [FileAllowed(['.jpg', '.jpeg', '.png', '.gif'], "Image formats only!")]) submit = SubmitField()
class TasksForm(FlaskForm): title = StringField('Title',validators=[DataRequired()]) description = StringField('Description') due = DateTimeField('Due',validators=[Optional()]) submit = SubmitField('Create Task')
class EditPlayOptionsForm(Form): autoRun = BooleanField("autorun") s_sDT = DateTimeField("sDT") s_eDT = DateTimeField("eDT") s_interval = DecimalField("interval", places=2)
class TestForm(Form): text = TextField(u'Name', [validators.required()]) textarea = TextAreaField(u'Text Area') boolean = BooleanField('Boolean') date = DateField('Date') datetime = DateTimeField('DateTime')
class DateSearchForm(FlaskForm): depart_time = DateTimeField("Depart Time") return_time = DateTimeField("Return Time") submit = SubmitField('Search')
class EventForm(FlaskForm): speaker_id = StringField('speaker_id') venue_id = StringField('venue_id') start_time = DateTimeField('start_time', validators=[DataRequired()], default=datetime.today())
class AssignmentForm(BaseForm): def __init__(self, course, obj=None, **kwargs): self.course = course self.obj = obj super(AssignmentForm, self).__init__(obj=obj, **kwargs) if obj: if obj.due_date == self.due_date.data: self.due_date.data = utils.local_time_obj(obj.due_date, course) if obj.lock_date == self.lock_date.data: self.lock_date.data = utils.local_time_obj( obj.lock_date, course) display_name = StringField('Display Name', validators=[validators.required()]) name = StringField('Endpoint (example: cal/cs61a/fa16/proj01)', validators=[validators.required()]) due_date = DateTimeField('Due Date (Course Time)', validators=[validators.required()]) lock_date = DateTimeField('Lock Date (Course Time)', validators=[validators.required()]) max_group_size = IntegerField('Max Group Size', default=1, validators=[ validators.InputRequired(), validators.number_range(min=1) ]) url = StringField('URL', validators=[validators.optional(), validators.url()]) revisions_allowed = BooleanField('Enable Revisions', default=False, validators=[validators.optional()]) autograding_key = StringField('Autograder Key', [validators.optional()]) continuous_autograding = BooleanField( 'Send Submissions to Autograder Immediately', [validators.optional()]) uploads_enabled = BooleanField('Enable Web Uploads', default=True, validators=[validators.optional()]) upload_info = StringField('Upload Instructions', validators=[validators.optional()]) visible = BooleanField('Visible On Student Dashboard', default=True) autograding_key = StringField('Autograder Key', validators=[validators.optional()]) def populate_obj(self, obj): """ Updates obj attributes based on form contents. """ super(AssignmentForm, self).populate_obj(obj) obj.due_date = utils.server_time_obj(self.due_date.data, self.course) obj.lock_date = utils.server_time_obj(self.lock_date.data, self.course) def validate(self): check_validate = super(AssignmentForm, self).validate() # if our validators do not pass if not check_validate: return False # Ensure the name has the right format: is_valid_endpoint = utils.is_valid_endpoint( self.name.data, ASSIGNMENT_ENDPOINT_FORMAT) has_course_endpoint = self.name.data.startswith(self.course.offering) if not has_course_endpoint or not is_valid_endpoint: self.name.errors.append( 'The endpoint should be of the form {0}/<name>'.format( self.course.offering)) return False # If the name is changed, ensure assignment offering is unique assgn = Assignment.query.filter_by(name=self.name.data).first() if assgn: self.name.errors.append('That endpoint already exists') return False return True
class Description(ModelForm, FormlyAttributes, DataSerializer): class Meta: model = alch.Description include_primary_keys = True only = ["name", "abstract", "rationale", "businesscase", "dependencies", "proposer", "customer", "created", "ended", "descriptionLastModified", "descriptionLastModifiedBy"] name = StringField(label=u"name", validators=[Required()], description=u"A clear description of the objective/purpose of " "the proposed project, and if known, what it would " "take to complete. The first 100 characters will be " "used in listings, etc.") abstract = TextAreaField(u"abstract", description=u"A clear description of the objective/purpose of the " "proposed project, and if known, what it would take " "to complete. The first 100 characters will be used " "in listings, etc.") rationale = TextAreaField(u"rationale", description=u"Why is the proposed work important? Tie it to " "STScI, mission and division strategies, where " "possible. Does it save costs, avoid risks, etc? If " "so, also indicate this in the relevant metadata.") businesscase = TextAreaField(u"business case", description=u"A business case compares the costs (labor, non-" "labor, opportunity) of doing the work with the " "potential benefits, and the risk of not doing, the " "work to show a return on investments. For projects " "that require significant investments, the funding " "source(s) and type(s) must also be identified.") dependencies = TextAreaField(u"dependencies", description=u"Describe any dependencies between this and other " "projects: must preceed, depends on, must be " "coordinated with, competes for unique resources " "with, ...") maturity = QuerySelectField(u"maturity", query_factory=maturity_choices, description=u"Maturity shows where an idea is on the path to " "full-fledged, planning-ready project.") proposer = StringField(u"proposer", description=u"Name of the organization and/or person that proposed " "the original idea.") customer = StringField(u"customer", description=u"Name of the person who says when the project is done.") sponsor = QuerySelectField(u"sponsor", query_factory=sponsor_choices, description=u"Name of the sponsoring organization for the project, " "which is the one that pays for doing the work. " "Together with Funding Source, this uniquely identifies " "how we will pay for doing the work or making the " "required capital investments.") fundingsource = QuerySelectField(u"funding source", query_factory=fundingsource_choices, description=u"Identify the funding source for this project. Here, " "'Other' will be used for grants and other contracts " "besides HST and JWST. Together with Sponsor this " "uniquely identifies how we will pay for doing the work " "or making the required capital investments.") host = QuerySelectField(u"host", query_factory=host_choices, description=u"Name of the host organization for the project, which " "is the one that manages doing the work.") stakeholders = QuerySelectMultipleField(u"stakeholders", query_factory=stakeholder_choices, description=u"Which organizations, besides the sponsor stand to be " "affected (positively or negatively) by this project?") technology = QuerySelectField(u"technology", query_factory=technology_choices, description=u"Identify the primary technology involved with/affected " "by this project. Use the categorization of the " "Technology Report. Note: The Implementation Plan is " "sorted by technology, and projects with no technology " "will not show up!") type = QuerySelectField(u"type", query_factory=type_choices, description=u"Categorize the project type.") drivers = QuerySelectMultipleField(u"drivers", query_factory=driver_choices, description=u"Identify the primary driver, or rationale, for this " "project.") created = DateField(u"created", description=u"The date on which the original idea was entered into " "the tool. This is a computed value.") ended = DateField(u"ended", description=u"The date on which the project was marked as ended. " "This is a computed value.") final = QuerySelectField(u"final state", query_factory=final_choices, description=u"If this project has come to an end, one way or the " "other, what is that final state?") # unfortunate name to follow naming convention for select multiple fields. childs = QuerySelectMultipleField(u"children", query_factory=child_choices, description=u"For an absorbed project, enter the project ID of the " "surviving project. For a split project, enter the " "project IDs of the child projects.") latest_dispositions = QuerySelectMultipleField(u"disposition", query_factory=disposition_choices, description=u"What decision was made during the planning cycle with " "respect to this project?") # We need a table-specific handle for these two generic columns since # otherwise the search will never get to just one column descriptionLastModified = DateTimeField(u"last updated", format="%Y-%m-%dT%H:%M:%S.%fZ") descriptionLastModifiedBy = StringField(u"last updated by") def __init__(self, *args, **kwargs): super(Description, self).__init__(*args, **kwargs) read_only(self.created) read_only(self.ended) read_only(self.latest_dispositions) read_only(self.descriptionLastModified) read_only(self.descriptionLastModifiedBy)
class SlowSearchForm(FlaskForm): start_time = DateTimeField('开始时间') end_time = DateTimeField('结束时间')
class NewPostForm(FlaskForm): post_body = StringField("Post Body", validators=[DataRequired()]) user_id = IntegerField("User ID") datetime = DateTimeField() submit = SubmitField("Send")
class ShowForm(Form): artist_id = IntegerField('artist_id', validators=[DataRequired(), numeric]) venue_id = IntegerField('venue_id', validators=[DataRequired(), numeric]) start_time = DateTimeField('start_time', validators=[DataRequired()], default=datetime.today())
class AddGameForm(Form): title = TextField('Username', [Required(message='Title Required')]) description = TextAreaField('Description', [Required(message='Description Required')]) price = DecimalField('Price', [Required(message='A Price is required')], places=2) discount = IntegerField("Discount", [ NumberRange(min=0, max=100, message="Discount must be between 0-100") ]) discount_expirable = BooleanField("Expirable") discount_end_date = DateTimeField("End Date") discount_start_date = DateTimeField("Start Date") developer = TextField('Developer') publisher = TextField('Publisher') status = SelectField(u'Field name', choices=["coming soon", "available"]) features = TextAreaField('Features') other_details = TextAreaField('Other Details') languages = TextAreaField('Languages') image_main = FileField("Main Image") image_banner = FileField("Banner Image") win_available = BooleanField("Available") win_min_os = TextField('Minimum OS') win_min_processor = TextField('Minimum Processor') win_min_memory = TextField('Minimum Memory') win_min_storage = TextField('Minimum Storage') win_min_graphics = TextField('Minimum Graphics') win_max_os = TextField('Recommended OS') win_max_processor = TextField('Recommended Processor') win_max_memory = TextField('Recommended Memory') win_max_storage = TextField('Recommended Storage') win_max_graphics = TextField('Recommended Graphics') linux_available = BooleanField("Available") linux_min_os = TextField('Minimum OS') linux_min_processor = TextField('Minimum Processor') linux_min_memory = TextField('Minimum Memory') linux_min_storage = TextField('Minimum Storage') linux_min_graphics = TextField('Minimum Graphics') linux_max_os = TextField('Recommended OS') linux_max_processor = TextField('Recommended Processor') linux_max_memory = TextField('Recommended Memory') linux_max_storage = TextField('Recommended Storage') linux_max_graphics = TextField('Recommended Graphics') mac_available = BooleanField("Available") mac_min_os = TextField('Minimum OS') mac_min_processor = TextField('Minimum Processor') mac_min_memory = TextField('Minimum Memory') mac_min_storage = TextField('Minimum Storage') mac_min_graphics = TextField('Minimum Graphics') mac_max_os = TextField('Recommended OS') mac_max_processor = TextField('Recommended Processor') mac_max_memory = TextField('Recommended Memory') mac_max_storage = TextField('Recommended Storage') mac_max_graphics = TextField('Recommended Graphics') tags = QuerySelectMultipleField('Tag', query_factory=lambda: Tag.query.all(), widget=widgets.ListWidget( html_tag="ol", prefix_label=False), option_widget=widgets.CheckboxInput(), get_label='title')
class PostForm(FlaskForm): title = StringField('Title', validators=[DataRequired()]) url = URLField('Contest URL', validators=[DataRequired()]) date = DateTimeField('Contest Date and Time', format='%Y-%m-%d %H:%M:%S') content = TextAreaField('Content', validators=[DataRequired()]) submit = SubmitField('Post')
class ListForm(FlaskForm): title = StringField('Title', validators=[DataRequired()]) date = DateTimeField('Due Date', format='%Y-%m-%dT%H:%M') submit = SubmitField('Done')
class Portfolio(ModelForm, FormlyAttributes, DataSerializer): class Meta: model = alch.Portfolio include_primary_keys = True only = ["rpu", "budgetIn", "portfolioLastModified", "portfolioLastModifiedBy"] flavor = QuerySelectField(u"portfolio category", query_factory=flavor_choices, description=u"Project portfolio management is not all about strategy " "and resources. Maintaining a balance between the " "projects that have to be done to keep us going, that " "allow us to get better at what we do, and that allow us " "to really change what we do has its own strategic " "value. This attribute categorizes this project in that " "dimension.") strategys = QuerySelectMultipleField(u"strategies", query_factory=strategy_choices, description=u"Which Institute strategic goals does this project " "support, if any?") initiative = QuerySelectField(u"initiative", query_factory=initiative_choices, description=u"Which Office of Technology initiative does this project " "belong in, if any?") scope = QuerySelectField(u"scope", query_factory=scope_choices, description=u"These next five attributes are criteria that, taken " "together, determine the level of attention that this " "project deserves. This may be reflected in the level of " "reporting to stakeholders and management, in the level " "of project management during project execution, etc. We " "don't have enough experience at the moment to say where " "the dividing lines are, so for now you will have to " "make your own best guess. Characterize the scope level " "of this project.") complexity = QuerySelectField(u"complexity", query_factory=complexity_choices, description=u"Characterize the complexity level of this project.") visibility = QuerySelectField(u"visibility", query_factory=visibility_choices, description=u"Characterize the level of visibility of this project. " "Does it reach the project at GSFC, NASA HQ, the " "astronomical community, the public?") risklevel = QuerySelectField(u"risk level", query_factory=risklevel_choices, description=u"Characterize the level of risk associated with not " "doing this project.") costlevel = QuerySelectField(u"cost level", query_factory=costlevel_choices, description=u"Characterize the cost level of this project.") rpu = DecimalField(u"effort", description=u"Enter the estimated project effort in RPUs. An RPU " "(Reference Project Unit) corresponds to a level of " "effort of 1000 hours during the 6 month planning " "period, with half of those hours coming from critical " "resources. A higher RPU may be assigned if the project " "has a high management overhead, extraordinary " "reporting requirements, high visibility, or any other " "factor likely to require above average effort in " "ordinary project management tasks.") budgetIn = FiscalQuarterField(u"budget in", description=u"For projects whose budget needs to be planned (e.g., " "ED-05), when will that happen?") # We need a table-specific handle for these two generic columns since # otherwise the search will never get to just one column portfolioLastModified = DateTimeField(u"last updated", format="%Y-%m-%dT%H:%M:%SZ") portfolioLastModifiedBy = StringField(u"last updated by") def __init__(self, *args, **kwargs): super(Portfolio, self).__init__(*args, **kwargs) read_only(self.portfolioLastModified) read_only(self.portfolioLastModifiedBy)
class EventForm(FlaskForm): title = StringField('Title', validators=[DataRequired()]) date = DateTimeField('Date and Time', format='%Y-%m-%dT%H:%M') description = StringField('Description') submit = SubmitField('Done')
class PostForm(FlaskForm): date = DateTimeField(u'时间', format='%Y/%m/%d %H:%M') location = StringField(u'去哪儿?', validators=[Required()]) body = PageDownField(u"做什么?", validators=[Required()]) submit = SubmitField(u'提交')
class DateTimeForm(Form): # Date filter form needed for gantt and graph view execution_date = DateTimeField("Execution date", widget=DateTimePickerWidget())
class PostForm(Form): user = StringField('user', validators=[DataRequired()]) timestamp = DateTimeField('timestamp', validators=[DataRequired()]) published = BooleanField('published', default=True) title = StringField('title', validators=[DataRequired()]) body = TextAreaField('body')
class ArtistForm(FlaskForm): # Create/Edit Artist form name = StringField('Name', validators=[DataRequired()]) city = StringField('City', validators=[DataRequired()]) state = SelectField('State', validators=[DataRequired(), Length(2)], choices=[ ('AL', 'AL'), ('AK', 'AK'), ('AZ', 'AZ'), ('AR', 'AR'), ('CA', 'CA'), ('CO', 'CO'), ('CT', 'CT'), ('DE', 'DE'), ('DC', 'DC'), ('FL', 'FL'), ('GA', 'GA'), ('HI', 'HI'), ('ID', 'ID'), ('IL', 'IL'), ('IN', 'IN'), ('IA', 'IA'), ('KS', 'KS'), ('KY', 'KY'), ('LA', 'LA'), ('ME', 'ME'), ('MT', 'MT'), ('NE', 'NE'), ('NV', 'NV'), ('NH', 'NH'), ('NJ', 'NJ'), ('NM', 'NM'), ('NY', 'NY'), ('NC', 'NC'), ('ND', 'ND'), ('OH', 'OH'), ('OK', 'OK'), ('OR', 'OR'), ('MD', 'MD'), ('MA', 'MA'), ('MI', 'MI'), ('MN', 'MN'), ('MS', 'MS'), ('MO', 'MO'), ('PA', 'PA'), ('RI', 'RI'), ('SC', 'SC'), ('SD', 'SD'), ('TN', 'TN'), ('TX', 'TX'), ('UT', 'UT'), ('VT', 'VT'), ('VA', 'VA'), ('WA', 'WA'), ('WV', 'WV'), ('WI', 'WI'), ('WY', 'WY'), ]) phone = StringField( # TODO implement validation logic for phone # 'Phone', validators=[DataRequired(), Length(10), Regexp(regex=r'^.*(\d{3}).*(\d{3}).*(\d{4}).*$', message='Use xxx-xxx-xxxx.')] 'Phone', validators=[DataRequired()]) website = StringField('Website', validators=[DataRequired(), URL()]) image_link = StringField('Image', validators=[URL()], default="/static/img/DefaultArtistImage.jpeg") facebook_link = StringField( # TODO implement enum restriction 'Facebook', validators=[URL()], default="http://") genres = SelectMultipleField( # TODO implement enum restriction 'Genres', validators=[DataRequired()], choices=[ ('Alternative', 'Alternative'), ('Blues', 'Blues'), ('Classical', 'Classical'), ('Country', 'Country'), ('Electronic', 'Electronic'), ('Folk', 'Folk'), ('Funk', 'Funk'), ('Hip-Hop', 'Hip-Hop'), ('Heavy Metal', 'Heavy Metal'), ('Instrumental', 'Instrumental'), ('Jazz', 'Jazz'), ('Musical Theatre', 'Musical Theatre'), ('Pop', 'Pop'), ('Punk', 'Punk'), ('R&B', 'R&B'), ('Reggae', 'Reggae'), ('Rock n Roll', 'Rock n Roll'), ('Soul', 'Soul'), ('Other', 'Other'), ]) available_start_time = DateTimeField('Available time start', validators=[DataRequired()], default=datetime.now()) available_stop_time = DateTimeField('Available time end', validators=[DataRequired()], default=datetime.now()) seeking_venue = BooleanField('Seeking Venue', default=True) seeking_description = TextField('Description', validators=[DataRequired()])
class SessionInsertForm(FlaskForm): place = StringField("Place") date = DateTimeField("Date") moderator = SelectField("Moderator") adventures = SelectMultipleField("Adventures")
class UpdateObsReqForm(FlaskForm): # fields # username = StringField('Username', default='', validators=[DataRequired()]) username = StringField('Username', default='') priority = SelectField('Priority', choices=PRIORITY, default=PRIORITY[0][0], validators=[DataRequired()]) object_name = StringField('Object Name', default='', validators=[DataRequired()]) ra_hms = StringField('RA', default='', validators=[ DataRequired(), Regexp(regex=regexp_ra, flags=re.IGNORECASE, message='RA format is HH:MM:SS.S') ]) dec_dms = StringField('Dec', default='', validators=[ DataRequired(), Regexp(regex=regexp_dec, flags=re.IGNORECASE, message='Dec format is +/-dd:mm:ss.s') ]) begin_iso = DateTimeField('UTC Begin DateTime', default=get_date_utctime(), format='%Y-%m-%d %H:%M:%S', validators=[DataRequired()]) end_iso = DateTimeField('UTC End DateTime', default=get_date_utctime(30), format='%Y-%m-%d %H:%M:%S', validators=[DataRequired()]) airmass = FloatField( 'Airmass', default=AIRMASS_DEFAULT, validators=[ DataRequired(), NumberRange(min=AIRMASS_MIN, max=AIRMASS_MAX, message=f'{AIRMASS_MIN} < airmass < {AIRMASS_MAX}') ]) lunarphase = SelectField('Lunar Phase', choices=LUNARPHASE, default=LUNARPHASE[0][0], validators=[DataRequired()]) photometric = BooleanField('Photometric', false_values=(False, 'false', 0, '0'), default=False) guiding = BooleanField('Guiding', false_values=(False, 'false', 0, '0'), default=False) non_sidereal = BooleanField('Non-Sidereal', false_values=(False, 'false', 0, '0'), default=False) filter_name = SelectField(choices=FILTER_NAMES, default=FILTER_NAMES[0][0], validators=[DataRequired()]) exp_time = FloatField( 'Exposure Time', default=EXP_TIME_DEFAULT, validators=[ DataRequired(), NumberRange( min=EXP_TIME_MIN, max=EXP_TIME_MAX, message=f'{EXP_TIME_MIN} < exposure time < {EXP_TIME_MAX}') ]) num_exp = IntegerField( '# Exposures', default=NUM_EXP_DEFAULT, validators=[ DataRequired(), NumberRange(min=NUM_EXP_MIN, max=NUM_EXP_MAX, message=f'{NUM_EXP_MIN} < # exposures < {NUM_EXP_MAX}') ]) binning = SelectField('Binning', choices=BINNING, default=BINNING[0][0], validators=[DataRequired()]) dither = SelectField('Dither', choices=DITHER, default=DITHER[0][0], validators=[DataRequired()]) cadence = SelectField('Cadence', choices=CADENCE, default=CADENCE[0][0], validators=[DataRequired()]) telescope = SelectField('Telescope', choices=FORM_TELESCOPES, default=FORM_TELESCOPES[1][1], validators=[DataRequired()]) instrument = SelectField('Instrument', choices=FORM_INSTRUMENTS, default=FORM_INSTRUMENTS[2][1], validators=[DataRequired()]) # non-sidereal widgets ns_params = StringField('Non-Sidereal Parameter(s)', default=NS_DEFAULT, validators=[DataRequired()]) # submit submit = SubmitField('Update Observation Request')
class ExampleForm(Form): title = StringField(u'Title') content = TextAreaField(u'Content') date = DateTimeField(u'Date', format='%d/%m/%Y %H:%M')
class ExampleForm(FlaskForm): #title = TextField(u'Title', validators = [Required()]) title = TextAreaField(u'Title', validators = [Required()]) content = TextAreaField(u'Content') date = DateTimeField(u'Date', format='%d/%m/%Y %H:%M')
class Tutoria_Add (Form): current_alumno_id = HiddenField('current_alumno_id') fecha = DateTimeField('fecha', [validators.Required(message='la fecha es obligatoria')]) hora = DateTimeField('hora', [validators.Required(message='la hora es obligatoria')]) current_tutoria_id = HiddenField('current_tutoria_id')
class ExpenditureForm(FlaskForm): cost_value = IntegerField("cost_value:") time = time_creating = DateTimeField("time: ") category_name = StringField("category_name: ") card_number = IntegerField("card_number:") submit = SubmitField("OK")
class AddConferenceForm(FlaskForm): name = StringField('name', validators=[DataRequired()]) date = DateTimeField('date', validators=[DataRequired()]) place = StringField('place', validators=[DataRequired()]) submit = SubmitField('submit')
class ShowForm(Form): artist_id = StringField('artist_id') venue_id = StringField('venue_id') start_time = DateTimeField('start_time', validators=[DataRequired()], default=datetime.today())
class VisitingForm(FlaskForm): region = SelectField("Region", choices=[]) branch = SelectField("Branch", choices=[]) doctor = SelectField("Doctor", choices=[]) date = DateTimeField("Date", format='%Y-%m-%d %h:%m:%s') submit = SubmitField("Submit")