class AddForm(r.FlaskForm): #TODO: List the fields here, FIELDS MUST BE PREFIXED WITH rgen_ # The names here after the rgen_ prefix must correspond to a var name in the respective model rgen_topic = r.StringField( 'MQTT Topic', validators=[r.Length(max=r.lim.MAX_MQTT_TOPIC_SIZE)]) rgen_description = r.TextAreaField( 'Description', validators=[r.Length(max=r.lim.MAX_DESCRIPTION_SIZE)]) rgen_stordur = r.IntegerField( 'Store at most N seconds (leave empty to store forever)') rgenbool_delonproc = r.SelectField('Delete messages after process?', choices=r.boolchoice) rgenbool_deloncas = r.SelectField('Delete messages on cascade?', choices=r.boolchoice) rgenbool_instantp = r.SelectField('Instantly process message?', choices=r.boolchoice) rgen_onrecv = r.SelectField('OnReceive action', choices=r.proctab_sel)
class AddForm(r.FlaskForm): #TODO: List the fields here, FIELDS MUST BE PREFIXED WITH rgen_ # The names here after the rgen_ prefix must correspond to a var name in the respective model rgen_username = r.StringField( 'MQTT UserName', validators=[r.Length(max=r.lim.MAX_USERNAME_SIZE)]) rgen_access_key = r.StringField( 'MQTT UserPass(Plaintext)', validators=[r.Length(max=r.lim.MAX_PASSWORD_SIZE)]) rgen_usertype = r.SelectField('API Type', choices=apitypes)
class AddForm(r.FlaskForm): #TODO: List the fields here, FIELDS MUST BE PREFIXED WITH rgen_ # The names here after the rgen_ prefix must correspond to a var name in the respective model rgenact_file = r.FileField('Target File') rgen_mimetype = r.SelectField('MIME type', choices=[('text/plain', "Plaintext"), ('image/jpeg', "Images (jpeg)"), ('application/pdf', "PDF"), ('text/html', "HTML"), ('application/x-troff-msvideo', '.avi'), ('audio/mpeg3', '.mp3'), ('video/mpeg', 'mpeg4')]) def file(self, return_form): out = {} print(return_form.rgenact_file.data, return_form.rgen_mimetype.data) out['filename'] = r.secure_filename( return_form.rgenact_file.data.filename) return_form.rgenact_file.data.save( os.path.join('pkg', r.const.STD_FILEDIR, out['filename'])) out['fileown'] = current_user.username return out
class AddForm(r.FlaskForm): #TODO: List the fields here, FIELDS MUST BE PREFIXED WITH rgen_ # The names here after the rgen_ prefix must correspond to a var name in the respective model rgen_long = r.StringField( 'New Longitude', validators=[r.InputRequired(), r.Length(min=1, max=10)]) rgen_lati = r.StringField( 'New Latitude', validators=[r.InputRequired(), r.Length(min=1, max=10)]) #sample datepicker widget (allows date selection), use the rgentim_ prefix rgentim_time = r.DateField('T stamp', widget=r.DatePickerWidget(), default=r.datetime.datetime.now()) #TODO: List select fields here, FIELDS MUST BE PREFIXED WITH rgensel_ # The names here after the rgen_ prefix must correspond to a var name in the respective model rgensel_route_id = r.SelectField('Assigned Route', choices=[('0', 'No route')]) fKeylist = {"route_id": ("Georoute", "name")}
class LsForm(r.FlaskForm): # Forms to allow filtering #tv0_start = r.LenientDateTimeField(\ # label='TimeV0 From', widget=r.DateTimePickerWidget(),\ # default=datetime.date.today()) #tv0_end = r.LenientDateTimeField(\ # label='TimeV0 To', widget=r.DateTimePickerWidget(),\ # default=(datetime.date.today()+\ # datetime.timedelta(hours = 23,minutes=59,seconds=59))) tv0_ignore = r.SelectField("TimeV0 Ignore?", choices=[("1", "Yes"), ("0", "No")]) tv0_start = r.DateField(\ 'TimeV0 From :', widget=r.DatePickerWidget(),\ format='%m/%d/%Y',\ default=datetime.date.today()) tv0_end = r.DateField(\ 'TimeV0 Until :', widget=r.DatePickerWidget(),\ format='%m/%d/%Y',\ default=datetime.date.today()+\ datetime.timedelta(hours=23,minutes=59,seconds=59)) query_limit = r.IntegerField('Query Limit :',validators=\ [r.InputRequired(),r.NumberRange(min=0)],default=0) def getrawquery(self): rawquery = StandardLog.query if (self.tv0_ignore.data == "0"): rawquery = rawquery.filter( StandardLog.timev0 >=\ self.tv0_start.data ) rawquery = rawquery.filter( StandardLog.timev0 <=\ self.tv0_end.data + datetime.timedelta(days=1)) if (self.query_limit.data > 0): rawquery = rawquery.limit(self.query_limit.data) return rawquery