Ejemplo n.º 1
0
class EditReadingForm(FlaskForm):
    readingDate = StringField('Date')
    amreading = DecimalField("Morning")
    pmreading = DecimalField('Evening:')
    annotation = StringField('Annotation')
    submit = SubmitField("Update")
Ejemplo n.º 2
0
class MyForm(Form):
    sender = StringField('sender', validators=[DataRequired()])
    recipient = StringField('recipient', validators=[DataRequired()])
    amount = DecimalField('amount', validators=[DataRequired()])
    submit = SubmitField('submit')
Ejemplo n.º 3
0
class Post(Form):
    left_tissue_height = DecimalField('Enter left tissue height')
    left_post_height = DecimalField('Enter left post height')
    right_tissue_height = DecimalField('Enter right tissue height')
    right_post_height = DecimalField('Enter right post height')
Ejemplo n.º 4
0
class AddTransactionForm(FlaskForm):
    amount = DecimalField('Amount', validators=[DataRequired()])
    description = StringField('Description', validators=[DataRequired()])
    credit = SubmitField('Credit')
    debit = SubmitField('Debit')
Ejemplo n.º 5
0
            validators.Required(),
            validators.Length(max=80)
        ])
    location = StringField('Location', [
            validators.Required(),
            validators.Length(max=80)
        ])
    date = DateField('Date', [
            validators.Required(),

           format='%m/%d/%Y'
        ])
    starttime = StringField('Start Time', [
            validators.Required(),
            
        ])
    endtime = StringField('End Time', [
            validators.Required(),
            validators.Length(max=80)
        ])
    imgpath = FileField('Image', validators=[
        FileAllowed(['jpg', 'png'], 'Images only!')
    ])
    
    price = DecimalField('Price',[
            validators.Required(),
        ])
    quantity = IntegerField('Quantity', [
            validators.Required(),
        ])
Ejemplo n.º 6
0
class InterestForm(FlaskForm):
    """
    利息配置

    INTEREST_PUT = 0.01  # 投资利息(日息)

    # 支付奖惩比例
    INTEREST_PAY_AHEAD = 0.02  # 提前支付奖金比例
    INTEREST_PAY_DELAY = 0.02  # 延迟支付罚金比例

    # 支付时间差
    DIFF_TIME_PAY_AHEAD = 60*60*1   # 提前支付奖金时间差
    DIFF_TIME_PAY_DELAY = 60*60*24  # 延迟支付罚金时间差

    # 确认奖惩比例
    INTEREST_REC_AHEAD = 0.02  # 提前确认奖金比例
    INTEREST_REC_DELAY = 0.02  # 延迟确认罚金比例

    # 确认时间差
    DIFF_TIME_REC_AHEAD = 60*60*1   # 提前确认奖金时间差
    DIFF_TIME_REC_DELAY = 60*60*24  # 延迟确认罚金时间差
    """
    # 利息配置
    INTEREST_PUT = DecimalField(u'投资利息(日息)',
                                validators=[
                                    DataRequired(u'利息不能为空'),
                                    NumberRange(min=0, message=u'利息必须为正数')
                                ])

    # 支付奖惩比例
    INTEREST_PAY_AHEAD = DecimalField(u'提前支付奖金比例',
                                      validators=[
                                          DataRequired(u'奖金比例不能为空'),
                                          NumberRange(min=0,
                                                      message=u'奖金比例必须为正数')
                                      ])
    INTEREST_PAY_DELAY = DecimalField(u'延迟支付罚金比例',
                                      validators=[
                                          DataRequired(u'罚金比例不能为空'),
                                          NumberRange(min=0,
                                                      message=u'罚金比例必须为正数')
                                      ])

    # 支付时间差
    DIFF_TIME_PAY_AHEAD = IntegerField(u'提前支付奖金时间',
                                       validators=[
                                           DataRequired(u'时间不能为空'),
                                           NumberRange(min=0,
                                                       message=u'时间必须为正数')
                                       ])
    DIFF_TIME_PAY_DELAY = IntegerField(u'延迟支付罚金时间',
                                       validators=[
                                           DataRequired(u'时间不能为空'),
                                           NumberRange(min=0,
                                                       message=u'时间必须为正数')
                                       ])

    # 确认奖惩比例
    INTEREST_REC_AHEAD = DecimalField(u'提前确认奖金比例',
                                      validators=[
                                          DataRequired(u'奖金比例不能为空'),
                                          NumberRange(min=0,
                                                      message=u'奖金比例必须为正数')
                                      ])
    INTEREST_REC_DELAY = DecimalField(u'延迟确认罚金比例',
                                      validators=[
                                          DataRequired(u'罚金比例不能为空'),
                                          NumberRange(min=0,
                                                      message=u'罚金比例必须为正数')
                                      ])

    # 确认时间差
    DIFF_TIME_REC_AHEAD = IntegerField(u'提前确认奖金时间',
                                       validators=[
                                           DataRequired(u'时间不能为空'),
                                           NumberRange(min=0,
                                                       message=u'时间必须为正数')
                                       ])
    DIFF_TIME_REC_DELAY = IntegerField(u'延迟确认罚金时间',
                                       validators=[
                                           DataRequired(u'时间不能为空'),
                                           NumberRange(min=0,
                                                       message=u'时间必须为正数')
                                       ])
Ejemplo n.º 7
0
class SignUpForm(Form):
    """
    Form for users to signup to the site.
    """

    # Text field for the users firstname.
    firstname = TextField('firstname',
                          validators=[DataRequired(),
                                      Length(min=2, max=20)])
    # Text field for the users surname.
    surname = TextField('surname',
                        validators=[DataRequired(),
                                    Length(min=2, max=20)])
    # Text field for the users email.
    email = TextField(
        'email',
        validators=[DataRequired(),
                    Email(message=None),
                    Length(max=50)])
    # Password field for the users chosen password.
    password = PasswordField(
        'password', validators=[DataRequired(),
                                Length(min=6, max=32)])
    # Password confirmation field.
    password_confirm = PasswordField('password confirmation',
                                     validators=[
                                         DataRequired(),
                                         EqualTo(
                                             'password',
                                             message='Passwords must match.')
                                     ])
    # Select field for selecting gender.
    gender = SelectField('gender',
                         choices=[('male', 'Male'), ('female', 'Female')])
    # Decimal field for the users height.
    height = DecimalField(
        'height',
        places=2,
        validators=[DataRequired(),
                    NumberRange(min=0, max=3), is_a_float])
    # Decimal field for the users weight.
    weight = DecimalField(
        'weight',
        places=2,
        validators=[DataRequired(),
                    NumberRange(min=0, max=250), is_a_float])
    # Text field for the first line of the users address.
    address_line_1 = TextField(
        'address',
        validators=[DataRequired(),
                    Length(min=5, max=200), is_alpha_numeric])
    # Text field for the users city.
    city = TextField(
        'city',
        validators=[DataRequired(),
                    Length(min=2, max=25), is_alpha_numeric])
    # Text field for the users postcode.
    postcode = TextField(
        'postcode',
        validators=[DataRequired(),
                    Length(min=5, max=9), is_alpha_numeric])
Ejemplo n.º 8
0
 class saleSub(FlaskForm):
     itemno = db.get_itemno_sell()
     item = SelectField(label='ITEM NUMBER', choices=itemno)
     price = DecimalField(label='PRICE')
Ejemplo n.º 9
0
class ValueCountForm(Form):
    value = DecimalField('Value of each note', places=1, default=5.0)
    count = IntegerField('Number of notes',
                         default=6,
                         validators=[Required(),
                                     NumberRange(min=0, max=20)])
Ejemplo n.º 10
0
class ExcerciseForm(FlaskForm):
    description = StringField('Exercise description',
                              validators=[DataRequired()])
    duration = DecimalField('Duration', validators=[DataRequired()])
Ejemplo n.º 11
0
 class PurchaseSub(FlaskForm):
     itemno = db.get_itemno()
     custid = db.get_custID()
     item = SelectField(label='ITEM NUMBER', choices=itemno)
     cust = SelectField(label='CUSTOMER ID', choices=custid)
     price = DecimalField(label='PRICE')
Ejemplo n.º 12
0
class AssetForm(FlaskForm):
    """The default asset form only allows to edit the name, numbers and market."""

    display_name = StringField("Display name")
    capacity_in_mw = DecimalField("Capacity in MW", places=2)
    unit = SelectField("Unit", default="MW", choices=[("MW", "MW")])
    event_resolution = IntegerField(
        "Resolution in minutes (e.g. 15)",
        default=15,
    )
    min_soc_in_mwh = DecimalField(
        "Minimum state of charge (SOC) in MWh",
        places=2,
        default=0,
    )
    max_soc_in_mwh = DecimalField(
        "Maximum state of charge (SOC) in MWh",
        places=2,
        default=0,
    )
    latitude = DecimalField(
        "Latitude",
        places=4,
        render_kw={"placeholder": "--Click the map or enter a latitude--"},
    )
    longitude = DecimalField(
        "Longitude",
        places=4,
        render_kw={"placeholder": "--Click the map or enter a longitude--"},
    )
    market_id = SelectField("Market", coerce=int)

    def validate_on_submit(self):
        if self.market_id.data == -1:
            self.market_id.data = (
                ""  # cannot be coerced to int so will be flagged as invalid input
            )
        return super().validate_on_submit()

    def to_json(self) -> dict:
        """ turn form data into a JSON we can POST to our internal API """
        data = copy.copy(self.data)
        data["name"] = data["display_name"]  # both are part of the asset model
        data[
            "unit"] = "MW"  # TODO: make unit a choice? this is hard-coded in the UI as well
        data["capacity_in_mw"] = float(data["capacity_in_mw"])
        data["min_soc_in_mwh"] = float(data["min_soc_in_mwh"])
        data["max_soc_in_mwh"] = float(data["max_soc_in_mwh"])
        data["longitude"] = float(data["longitude"])
        data["latitude"] = float(data["latitude"])

        if "csrf_token" in data:
            del data["csrf_token"]

        return data

    def process_api_validation_errors(self, api_response: dict):
        """Process form errors from the API for the WTForm"""
        if not isinstance(api_response, dict):
            return
        for error_header in ("json", "validation_errors"):
            if error_header not in api_response:
                continue
            for field in list(self._fields.keys()):
                if field in list(api_response[error_header].keys()):
                    self._fields[field].errors.append(
                        api_response[error_header][field])
Ejemplo n.º 13
0
class AddPayPeriodExpense(FlaskForm):
    name = StringField('Name of bill', validators=[DataRequired()])
    cost = DecimalField('Cost of bill', validators=[DataRequired()])
    category = StringField('Category of bill (optional)',
                           validators=[Optional()])
    submit = SubmitField('Add pay period expense')
Ejemplo n.º 14
0
class MyForm(FlaskForm):
    name = StringField('name', validators=[DataRequired()])
    type = StringField('type', validators=[DataRequired()])
    price = DecimalField('price', validators=[DataRequired()])
    picture = FileField('picture')
    submit = SubmitField(label='Add')
Ejemplo n.º 15
0
class LoginForm(FlaskForm):
    matricula = DecimalField('Matricula', validators=[DataRequired()])
    password = PasswordField('Senha', validators=[DataRequired()])

    submit = SubmitField('Entrar')
Ejemplo n.º 16
0
class IncomeForm(FlaskForm):
    income = DecimalField('Income (after taxes)', validators=[DataRequired()])
    income_pct = DecimalField('Percent to Commit for Loans',
                              validators=[DataRequired()])
    submit = SubmitField('Submit')
Ejemplo n.º 17
0
class form_binomial(Form):
    p = DecimalField('porcentaje exitos: ', validators=[validators.required()], places = 2)
    n = IntegerField('total de intentos', validators=[validators.required()])
    x = IntegerField('exitos esperados', validators=[validators.required()])
Ejemplo n.º 18
0
class LoanForm(FlaskForm):
    name = TextAreaField('Loan Name', validators=[DataRequired()])
    balance = DecimalField('Current Balance', validators=[DataRequired()])
    int_rate = DecimalField('Interest Rate (APR)', validators=[DataRequired()])
    submit = SubmitField('Add Loan')
Ejemplo n.º 19
0
class UploadReceiptForm(FlaskForm):
    soft_plastic = DecimalField('Soft Plastic Weight')
    hard_plastic = DecimalField('Hard Plastic Weight')
    styrofoam = DecimalField('Styrofoam Weight')
    submit = SubmitField('Submit')
Ejemplo n.º 20
0
class BodyweightForm(Form):
    bodyweight_kg = DecimalField('bodyweight in kg', [validators.DataRequired()])
    notes = StringField('diet, mood notes', [validators.DataRequired()])
Ejemplo n.º 21
0
class UploadForm(FlaskForm):
	product = StringField('product', validators=[InputRequired()], render_kw={"placeholder": "Enter product name"})
	price = DecimalField('price',validators=[InputRequired()], render_kw={"placeholder": "Price(Must be numbers)"})
	address = StringField('address',validators=[InputRequired()], render_kw={"placeholder": "Grocery store's address"})
	price_type = RadioField(choices=[('Regular','Regular'),('Special','Special')],default='Regular')
Ejemplo n.º 22
0
class PredictForm(FlaskForm):
	Wind_Speed = DecimalField('Wind Speed (m/s)')
	Theoretical_Power_Curve = DecimalField('Theoretical_Power_Curve (KWh)')
	Wind_Direction = DecimalField('Wind Direction (°)')
	submit = SubmitField('Predict')
	abc = "" 
Ejemplo n.º 23
0
class TransectionForm(FlaskForm):
    from_user = StringField("From_user ", validators=[DataRequired()])
    to_user = StringField('To_user', validators=[DataRequired()])
    amount_transfered = DecimalField("amount", validators=[DataRequired()])
    submit = SubmitField("Submit")
Ejemplo n.º 24
0
class CreateTermProduct(FlaskForm):
    name = StringField('Name:', validators=[DataRequired()])
    maturity = IntegerField('Maturity:', validators=[DataRequired()])
    rate = DecimalField('Rate:', validators=[DataRequired()], places=2)
    info = TextAreaField('Info:', validators=[DataRequired()])
    submit = SubmitField('CreateTerm')
Ejemplo n.º 25
0
class SalaryForm(Form):
    from_country = SelectField('Source country', coerce=int)
    salary = DecimalField("Amount in source country's local currency",
                          validators=[InputRequired()])
    to_country = SelectField('Target country', coerce=int)
Ejemplo n.º 26
0
class UserSettingsForm(Form):
    """
    A form for submitting resource reviews.

    Fields on the form:
        email
        display_name
        default_location
        default_latitude (Hidden)
        default_longitude (Hidden)
        populations
    """
    email = StringField(
        'Email',
        description='This is used to reset your password in case ' +
        'you are locked out.\n\nYour email is not shared with others.',
        validators=[InputRequired(), Email(),
                    Length(1, 70)])

    display_name = StringField(
        'Displayed Name',
        description='This is the name that will be displayed with ' +
        'any of your reviews.',
        validators=[InputRequired(), Length(2, 100)])

    default_location = StringField(
        'Default Location',
        description='By default, this location will be used when you ' +
        'search for resources.',
        validators=[Optional(), Length(0, 500)])

    default_latitude = DecimalField(widget=HiddenInput(),
                                    validators=[Optional()])

    default_longitude = DecimalField(widget=HiddenInput(),
                                     validators=[Optional()])

    populations = GroupedSelectMultipleField(
        label='Identities (Optional)',
        coerce=int,
        description='Choose any number of identities to which you feel ' +
        'you belong.\n\n' +
        'This helps tailor any review scores to individuals, ' +
        'including yourself, with similar identities.',
        validators=[Optional()])

    submit = SubmitField('Save')

    def __init__(self, formdata, obj, grouped_population_choices):
        super(UserSettingsForm, self).__init__(formdata=formdata, obj=obj)

        # Pass in our grouped populations verbatim
        self.populations.choices = grouped_population_choices

        # Set the default and force a re-analysis of populations *without* the
        # underlying object (i.e. only with form data), because WTForms
        # doesn't know how to translate the populations collection into
        # appropriate defaults from the obj instance.
        self.populations.default = [p.id for p in obj.populations]
        self.populations.process(formdata)

    def validate_email(self, field):
        """
        Validates that the provided email is unique.
        """
        existing_user = User.query. \
            filter(User.email == field.data). \
            filter(User.id != current_user.id). \
            first()

        if existing_user:
            raise ValidationError(
                'A user already exists in the database with that email.')
Ejemplo n.º 27
0
class calibrationFactor(FlaskForm):
    # REVIEW: does this even get used
    cal_factor = DecimalField("Calibration Factor")
    submit = SubmitField('Submit')
Ejemplo n.º 28
0
class PIDModBase(FlaskForm):
    function_id = StringField('Function ID', widget=widgets.HiddenInput())
    function_type = StringField('Function Type', widget=widgets.HiddenInput())
    name = StringField(
        TRANSLATIONS['name']['title'],
        validators=[DataRequired()])
    measurement = StringField(
        TRANSLATIONS['measurement']['title'],
        validators=[DataRequired()])
    direction = SelectField(
        lazy_gettext('Direction'),
        choices=[
            ('raise', lazy_gettext('Raise')),
            ('lower', lazy_gettext('Lower')),
            ('both', lazy_gettext('Both'))
        ],
        validators=[DataRequired()]
    )
    period = DecimalField(
        TRANSLATIONS['period']['title'],
        validators=[validators.NumberRange(
            min=1,
            max=86400
        )],
        widget=NumberInput(step='any')
    )
    log_level_debug = BooleanField(
        TRANSLATIONS['log_level_debug']['title'])
    start_offset = DecimalField(
        TRANSLATIONS['start_offset']['title'],
        widget=NumberInput(step='any'))
    max_measure_age = DecimalField(
        TRANSLATIONS['max_age']['title'],
        validators=[validators.NumberRange(
            min=1,
            max=86400
        )],
        widget=NumberInput(step='any')
    )
    setpoint = DecimalField(
        TRANSLATIONS['setpoint']['title'],
        validators=[validators.NumberRange(
            min=-1000000,
            max=1000000
        )],
        widget=NumberInput(step='any')
    )
    band = DecimalField(
        lazy_gettext('Band (+/- Setpoint)'),
        widget=NumberInput(step='any'))
    store_lower_as_negative = BooleanField(lazy_gettext('Store Lower as Negative'))
    k_p = DecimalField(
        lazy_gettext('Kp Gain'),
        validators=[validators.NumberRange(
            min=0
        )],
        widget=NumberInput(step='any')
    )
    k_i = DecimalField(
        lazy_gettext('Ki Gain'),
        validators=[validators.NumberRange(
            min=0
        )],
        widget=NumberInput(step='any')
    )
    k_d = DecimalField(
        lazy_gettext('Kd Gain'),
        validators=[validators.NumberRange(
            min=0
        )],
        widget=NumberInput(step='any')
    )
    integrator_max = DecimalField(
        lazy_gettext('Integrator Min'),
        widget=NumberInput(step='any'))
    integrator_min = DecimalField(
        lazy_gettext('Integrator Max'),
        widget=NumberInput(step='any'))
    raise_output_id = StringField(lazy_gettext('Output (Raise)'))
    raise_output_type = StringField(lazy_gettext('Action (Raise)'))
    lower_output_id = StringField(lazy_gettext('Output (Lower)'))
    lower_output_type = StringField(lazy_gettext('Action (Lower)'))
    setpoint_tracking_type = StringField(TRANSLATIONS['setpoint_tracking_type']['title'])
    setpoint_tracking_method_id = StringField('Setpoint Tracking Method')
    setpoint_tracking_input_math_id = StringField('Setpoint Tracking Input/Math')
    setpoint_tracking_max_age = DecimalField('Max Age (seconds)',
        validators=[Optional()],
        widget=NumberInput(step='any'))
    pid_mod = SubmitField(TRANSLATIONS['save']['title'])
    pid_hold = SubmitField(lazy_gettext('Hold'))
    pid_pause = SubmitField(lazy_gettext('Pause'))
    pid_resume = SubmitField(lazy_gettext('Resume'))
    pid_delete = SubmitField(TRANSLATIONS['delete']['title'])
    pid_activate = SubmitField(TRANSLATIONS['activate']['title'])
    pid_deactivate = SubmitField(TRANSLATIONS['deactivate']['title'])
    order_up = SubmitField(TRANSLATIONS['up']['title'])
    order_down = SubmitField(TRANSLATIONS['down']['title'])
Ejemplo n.º 29
0
class CreateEventForm(Form):
	eid = IntegerField(id = 'eid', default=-1)
	title = TextField(id='title', label='Title', validators=[validators.Required("Title is missing")])
	description = TextAreaField(id='description', label='Description')
	building = TextField(id = 'building', validators=[validators.Required("Building name is missing")])
	addrAndStreet = TextField(id ='addrAndStreet', validators=[validators.Required("Address is missing")])
	city = TextField(id = 'city', default='Champaign', validators=[validators.Required("City is missing")])
	zipcode = TextField(id = 'zipcode', default='61820', validators=[validators.InputRequired("Zipcode is invalid")])
	startDate = TextField(id = 'startDate', label='Start Date', validators=[validators.Required("Start date is missing")])
	endDate = TextField(id = 'endDate', label='End Date', validators=[validators.Required("End date is missing")])
	lowPrice = DecimalField(id = 'lowPrice', places=2, validators=[validators.InputRequired("Lower bound on price range is invalid")])
	highPrice = DecimalField(id = 'highPrice', places=2, validators=[validators.InputRequired("Upper bound on price range is invalid")])
	categories = SelectMultipleField(id ='category', label='Categories', validators=[validators.Required("Select at least one category")])
	eventTypes = SelectMultipleField(id ='eventtype', label='Event Types', validators=[validators.Required("Select at least one event type")])
	# photo = FileField(label = 'Event image')
	submit = SubmitField("Create Event") 

	def __init__(self, form):
		Form.__init__(self, form)

		self.connection = mysql.get_db()
		self.cursor = self.connection.cursor()

		# set category choices
		self.cursor.execute("SELECT name FROM Category")
		categories = [row[0] for row in self.cursor.fetchall()]
		self.categories.choices = [ (c, c) for c in categories ]

		# set event types choices
		self.cursor.execute("SELECT name FROM EventType")
		event_types = [row[0] for row in self.cursor.fetchall()]
		self.eventTypes.choices = [ (e, e) for e in event_types ]

		# startDate, startTime, endDate, endTime in database format
		self.start = ('', '')
		self.end = ('', '')

		#lat and lng
		self.lat = 0,0
		self.lng = 0.0

	def validate(self):
		if not Form.validate(self):
			return False

		valid = True

		# zipcode
		try:
			# check if zipcode is within possible Illinois zipcodes
			if int(self.zipcode.data) < 60001 or int(self.zipcode.data) > 62999:
				self.zipcode.errors.append("Zipcode is invalid")
				valid = False
		except:
			self.zipcode.errors.append("Zipcode is invalid")
			valid = False

		# lowPrice and highPrice
		if self.lowPrice.data < 0 or self.highPrice.data < 0 or self.lowPrice.data > self.highPrice.data:
			self.lowPrice.errors.append("Price range is invalid")
			valid = False

		# startDate and endDate
		parsedDates = True
		try:
			start = datetime.strptime(self.startDate.data, '%m/%d/%Y %I:%M %p')
		except:
			self.startDate.errors.append("Start date is invalid")
			parsedDates = False
			valid = False
		try:
			end = datetime.strptime(self.endDate.data, '%m/%d/%Y %I:%M %p')
		except:
			self.endDate.errors.append("End date is invalid")
			parsedDates = False
			valid = False

		if parsedDates:
			if start >= end or end < datetime.now():
				self.startDate.errors.append("Start and end dates are invalid")
				valid = False
			# valid dates
			else:
				self.start = ("{}-{}-{}".format(start.year, start.month, start.day), "{}:{}:00".format(start.hour, start.minute))
				self.end = ("{}-{}-{}".format(end.year, end.month, end.day), "{}:{}:00".format(end.hour, end.minute))
			
				# check for existing event if creating a new event
				if self.eid.data == -1:
					result_len = self.cursor.execute("SELECT * FROM Event WHERE title='{}' AND startDate='{}' AND startTime='{}'".format(self.title.data, self.start[0], self.start[1]))
					if result_len >= 1:
						self.title.errors.append("An event with similar information already exists")

		# validate address
		locstr = self.addrAndStreet.data+ "," + self.city.data + ", IL," + str(self.zipcode.data)
		gmaps = googlemaps.Client(key=GMAPS_KEY)
		ret = gmaps.geocode(address=locstr)
		if len(ret) == 0:
			valid = False
			self.addrAndStreet.errors.append("Invalid address")
		else:
			# look for minor errors in address
			street_num = ""
			street_name = ""
			city = ""
			zipcode = ""
			for dict in ret[0]['address_components']:
				if 'street_number' in dict['types']:
					street_num = dict['short_name']
				elif 'route' in dict['types']:
					street_name = dict['short_name']
				elif 'locality' in dict['types']:
					city = dict['short_name']
				elif 'postal_code' in dict['types']:
					zipcode = dict['short_name']

			if not (street_num and street_name and city and zipcode):
				valid = False
				self.addrAndStreet.errors.append("Invalid address")
			else:
				self.addrAndStreet.data = street_num + " " + street_name
				self.city.data = city
				self.zipcode.data = zipcode

				self.lat = "{0:.7f}".format(ret[0]['geometry']['location']['lat'])
				self.lng = "{0:.7f}".format(ret[0]['geometry']['location']['lng'])
		
		return valid
Ejemplo n.º 30
0
class DEholdEntryForm(FlaskForm):
    date = StringField('Date', default="2019-12-22")
    heldValue = DecimalField("Held Value")