class BulkTaskEpiCollectPlusImportForm(BulkTaskImportForm): msg_required = lazy_gettext("You must provide an EpiCollect Plus " "project name") msg_form_required = lazy_gettext("You must provide a Form name " "for the project") epicollect_project = TextField(lazy_gettext('Project Name'), [validators.Required(message=msg_required)]) epicollect_form = TextField(lazy_gettext('Form name'), [validators.Required(message=msg_required)]) template_id = "epicollect" form_id = "epiform" form_detector = "epicollect_project" def import_epicollect_tasks(self, data): for d in data: yield {"info": d} def get_data_url(self, form): return 'http://plus.epicollect.net/%s/%s.json' % \ (form.epicollect_project.data, form.epicollect_form.data) def get_epicollect_data_from_request(self, r): if r.status_code == 403: msg = "Oops! It looks like you don't have permission to access" \ " the EpiCollect Plus project" raise BulkImportException(gettext(msg), 'error') if not 'application/json' in r.headers['content-type']: msg = "Oops! That project and form do not look like the right one." raise BulkImportException(gettext(msg), 'error') return self.import_epicollect_tasks(json.loads(r.text)) def tasks(self, form): dataurl = self.get_data_url(form) r = requests.get(dataurl) return self.get_epicollect_data_from_request(r)
class CreateUpdateProfileForm(wtf.Form): """Form for Creating and Updating User Profiles .. method:: CreateUpdateProfileForm(fname, mname, lname, caseid, avatar, contract[, family, big]) :param fname: Brother's first name :type fname: unicode :param mname: Brother's middle name :type mname: unicode :param lname: Brother's last name :type lname: unicode :param caseid: Brother's Case ID :type caseid: unicode :param avatar: Brother's avatar URL :type avatar: unicode :param contract: Brother's signed contract type :type contract: application.model.Contract :param family: Brother's assigned family :type family: application.model.Family :param big: Brother's assigned big :type big: unicode :rtype: Form instance """ fname = wtf.TextField('First Name: ', validators=[validators.Required()]) mname = wtf.TextField('Middle Name: ', validators=[validators.Optional()]) lname = wtf.TextField('Last Name: ', validators=[validators.Required()]) caseid = wtf.TextField('Case ID: ', validators=[validators.Required()]) contract = wtf.TextField('Contract type: ', validators=[validators.Optional()]) family = wtf.TextField('Family: ', validators=[validators.Optional()]) big = wtf.TextField('Big: ', validators=[validators.Optional()]) avatar = wtf.TextField('Gravatar Email: ', validators=[validators.Optional()]) password = wtf.PasswordField('Password: ', validators=[validators.Optional()])
class MainUpdateUserForm(wtf.Form): fname = wtf.TextField('First Name*', [validators.Required()]) mname = wtf.TextField('Middle Name', [validators.Optional()]) lname = wtf.TextField('Last Name*', [validators.Required()]) avatar = wtf.TextField( 'Gravatar Email', [validators.Optional(), validators.Email()])
class AppForm(Form): id = IntegerField(label=None, widget=HiddenInput()) name = TextField(lazy_gettext('Name'), [ validators.Required(), pb_validator.Unique(db.session, model.App, model.App.name, message="Name is already taken.") ]) short_name = TextField(lazy_gettext('Short Name'), [ validators.Required(), pb_validator.NotAllowedChars(), pb_validator.Unique( db.session, model.App, model.App.short_name, message=lazy_gettext("Short Name is already taken.")) ]) description = TextField(lazy_gettext('Description'), [ validators.Required( message=lazy_gettext("You must provide a description.")) ]) thumbnail = TextField(lazy_gettext('Icon Link')) allow_anonymous_contributors = SelectField( lazy_gettext('Allow Anonymous Contributors'), choices=[('True', lazy_gettext('Yes')), ('False', lazy_gettext('No'))]) long_description = TextAreaField(lazy_gettext('Long Description')) sched = SelectField( lazy_gettext('Task Scheduler'), choices=[('default', lazy_gettext('Default')), ('breadth_first', lazy_gettext('Breadth First')), ('depth_first', lazy_gettext('Depth First')), ('random', lazy_gettext('Random'))], ) hidden = BooleanField(lazy_gettext('Hide?'))
class RegistrationForm(wtf.Form): email = wtf.TextField('Email Address', [validators.Required()]) password = wtf.PasswordField('New Password', [ validators.Required(), validators.EqualTo('confirm', message='Passwords must match') ]) confirm = wtf.PasswordField('Repeat Password')
class RegistrationForm(Form): username = TextField('Username', [ validators.Required(), validators.Length( min=3, max=30, message='Username must be %(min)d - %(max)d chars'), validators.Regexp( '^[A-Za-z0-9\-_]+$', message= 'Username may only contain letters, numbers, dashes and underscores' ) ]) email = TextField('Email', [ validators.Required(), validators.Email(), validators.Length(max=255) ]) password = PasswordField('Password', [ validators.Required(), validators.EqualTo('password_confirm', message='Passwords did not match') ]) password_confirm = PasswordField('Confirm Password') submit = SubmitField('Register') def validate_username(form, field): user = models.User.query.filter_by(username=field.data).all() if user: raise ValidationError, 'Username already exists'
class LoginForm(Form): username = TextField( 'Username', [validators.Required(message="The username is required")]) password = PasswordField( 'Password', [validators.Required(message="You must provide a password")])
class FormTache(wtf.Form): titre = wtf.StringField( label='Nom de la tache :', validators=[validators.Required('Champ Obligatoire')]) description = wtf.TextAreaField(label='Description :') heure = wtf.StringField( label='Nombre d\'heure :', default=0, widget=NumberInput(), validators=[validators.Required('Champ Obligatoire')]) date_start = wtf.DateField(label='Date de debut :', format='%d/%m/%Y', default=datetime.date.today(), validators=[controle_date_start]) facturable = wtf.StringField( label='Facturation :', validators=[validators.Required('Champ Obligatoire')]) projet_id = wtf.SelectField(label='Projet :', coerce=str, validators=[projet_id_required]) user_id = wtf.SelectField( label='Utilisateur :', coerce=str, validators=[validators.Required('Champ Obligatoire')]) prestation_id = wtf.StringField( label='Prestation :', validators=[validators.Required('Champ Obligatoire')]) contact = wtf.HiddenField(default=None) id = wtf.HiddenField()
class NewPostForm(wtf.Form): """ Create a new blog post """ title = wtf.TextField('Title*', [validators.Required()]) text = wtf.TextAreaField('Text*', [validators.Required()])
class FormBesoin(wtf.Form): commande = wtf.StringField( label="Commande", validators=[validators.Required('Champ Obligatoires')]) date_echeance = wtf.DateField( label='Date echeance', format='%d/%m/%Y', validators=[validators.Required('Champ Obligatoire'), controle_date]) montant = wtf.FloatField( label='Montant', default=0, widget=NumberInput(), validators=[validators.Required('Champ Obligatoire')]) avance = wtf.FloatField(label='Avance', default=0, widget=NumberInput(), validators=[controle_avance]) projet_id = wtf.SelectField( label='Projet', coerce=str, validators=[validators.Required('Champ Obligatoire')]) fournisseur = wtf.StringField( label='Fournisseur', validators=[validators.Required('Champ Obligatoire')]) solde = wtf.HiddenField() relance = wtf.HiddenField() id = wtf.HiddenField()
class FormTemps(wtf.Form): derob = wtf.HiddenField() derob_day = wtf.HiddenField() date = wtf.DateField(label='Date d\'execution :', format="%d/%m/%Y", validators=[validators.Required('Champ Obligatoire'), control_date]) description = wtf.TextAreaField(label='Description :', validators=[validators.Required('Champ Obligatoire')]) heure = wtf.StringField(label='Nbre d\'Heure :', validators=[control_heure], default='00:00') jour = wtf.IntegerField(label='Nbre de jour :', default=0, widget=NumberInput(), validators=[control_day])
class AddressForm(wtf.Form): addrName = wtf.TextField('Name', [validators.Optional()]) street1 = wtf.TextField('Street', [validators.Required()]) street2 = wtf.TextField('', [validators.Optional()]) city = wtf.TextField('City', [validators.Required()]) state = wtf.TextField('State', [validators.Required()]) zip_code = wtf.IntegerField('Zip', [validators.Required()]) key = wtf.HiddenField([validators.Optional()])
class CreateServiceEventForm(wtf.Form): name = wtf.TextField('Name*', [validators.Required()]) desc = wtf.TextField('Description', [validators.Optional()]) start_time = wtf.DateTimeField('Start Time*', [validators.Required()]) end_time = wtf.DateTimeField('End Time*', [validators.Required()]) location = wtf.TextField('Location*', [validators.Required()]) addinfo = wtf.TextField('Additional Info', [validators.Optional()]) max_bros = wtf.IntegerField('Maximum Number of Brothers', [validators.Optional()])
class LoginForm(Form): username = TextField('Username', [ validators.Required(), validators.Length(min=4, max=32)]) password = PasswordField('Password', [ validators.Required(), ]) remember_me = BooleanField('Remember me?')
class FormAjustement(wtf.Form): id = wtf.HiddenField() ligne_data = wtf.HiddenField(validators=[valid_ligne_data]) date_bon = wtf.DateField(label='Date :', format="%d/%m/%Y", validators=[validators.Required('Date obligatoire')]) magasin_origine = wtf.SelectField(label='Magasin :', coerce=str, validators=[validators.Required('Magasin obligatoire')]) etat = wtf.SelectField(label='Motif d\'ajustement :', coerce=str, choices=choice, validators=[validators.Required('Motif d\'ajustement obligatoire')])
class CategoryForm(Form): id = IntegerField(label=None, widget=HiddenInput()) name = TextField(lazy_gettext('Name'), [validators.Required(), pb_validator.Unique(db.session, model.Category, model.Category.name, message="Name is already taken.")]) description = TextField(lazy_gettext('Description'), [validators.Required()])
class ChangePasswordForm(wtf.Form): old_password = wtf.PasswordField('Old Password: '******'New Password: '******'Confirm New Password: '******'new_password', message='Passwords must match!') ])
class HourReviewForm(wtf.Form): status = wtf.RadioField('Status', [validators.Required()], choices=[('approved', 'Approved'), ('rejected', 'Rejected'), ('pending', 'Pending')]) hour_report_id = wtf.HiddenField('Hour Report ID', [validators.Required()]) user_name = wtf.HiddenField('Name', [validators.Optional()]) hours = wtf.HiddenField('Hours', [validators.Optional()]) minutes = wtf.HiddenField('Minutes', [validators.Optional()])
class LoginForm(Form): email = TextField( lazy_gettext('E-mail'), [validators.Required(message=lazy_gettext("The e-mail is required"))]) password = PasswordField(lazy_gettext('Password'), [ validators.Required( message=lazy_gettext("You must provide a password")) ])
class PicUploadForm(wtf.Form): PicTitle = wtf.TextField('What you bought:', validators=[validators.Required()]) PicImage = wtf.FileField('Picture of it:', validators=[checkfile]) PicWhere = wtf.TextField('Where you bought it:', validators=[validators.Required()]) PicPrice = wtf.TextField('How much you paid for it:', validators=[validators.Required()]) PicPoster = wtf.TextField('Your name:', validators=[validators.Required()])
class LoginForm(Form): email = TextField("email", [ validators.Required(), Exists( User, User.email, message="We do not recognize that email address") ]) password = PasswordField( "password", [validators.Required(), CheckPassword()])
class FormBon(wtf.Form): id = wtf.HiddenField() ligne_data = wtf.HiddenField(validators=[valid_ligne_data]) date_bon = wtf.DateField(label='Date du bon :', format="%d/%m/%Y", validators=[validators.Required('Date du bon de commande obligatoire')]) date_prevu_bon = wtf.DateField(label='Date prevu :', format="%d/%m/%Y", validators=(validators.Optional(), )) magasin_origine = wtf.SelectField(label='Magasin :', coerce=str, validators=[validators.Required('Magasin d\'origine obligatoire')]) fournisseur = wtf.SelectField(label='Fournisseur :', coerce=str, validators=[validators.Required(message='Fournisseur obligatoire')])
class AddQuestionForm(wtf.Form): survey = wtf.StringField(u'Add to Survey', validators=[validators.Required()]) question_type = wtf.StringField( u'Question Type', validators=[validators.AnyOf(('open', 'closed', 'peer'))]) is_active = wtf.BooleanField(u'Active', validators=[validators.Required()]) question = wtf.StringField(u'Question', validators=[validators.Required()]) dimension = wtf.StringField(u'Dimension', validators=[validators.Required()])
class NotesForm(wtf.Form): subject_list = [('0', 'English'), ('1', 'Philosophy'), ('2', 'Theology'), ('3', 'Mathematics')] title = wtf.StringField('Title', validators=[validators.Required()]) author = wtf.StringField('Author', validators=[validators.Required()]) description = wtf.TextAreaField('Description', validators=[validators.Required()]) subject = wtf.SelectField(choices=subject_list)
class FormFerier(wtf.Form): id = wtf.HiddenField() date = wtf.DateField(label='Date du jour ferier :', format="%d/%m/%Y", validators=[ validators.Required('Champ Obligatoire'), control_date, exist_date ]) description = wtf.TextAreaField( label='Description :', validators=[validators.Required('Champ Obligatoire')])
class FormOpportunite(wtf.Form): id = wtf.HiddenField() etape = wtf.HiddenField() name = wtf.StringField( label='Objet de l\'opportunite :', validators=[validators.Required(message='Champ obligatoire')]) vendeur_id = wtf.SelectField( label='Vendeur :', coerce=str, validators=[validators.Required(message='Champ obligatoire')]) note = wtf.TextAreaField(label='Note interne :')
class FormLogin(wtf.Form): email = wtf.StringField(label='Adresse Email', validators=[ validators.Email('Adresse Email invalide'), validators.Required('Information obligatoire') ]) password = wtf.PasswordField( label='Mot de passe', validators=[ validators.Required('Information obligatoire'), password_validator ])
class RecordAliasForm(wtf.Form): type = wtf.SelectField("Type", choices=RECORD_CHOICES) name = wtf.TextField("Name", validators=[validators.Required()]) alias_hosted_zone_id = wtf.TextField("Alias hosted zone ID", validators=[validators.Required()]) alias_dns_name = wtf.TextField("Alias DNS name", validators=[validators.Required()]) ttl = wtf.IntegerField("TTL", default="86400", validators=[validators.Required()]) comment = wtf.TextAreaField("Comment")
class RegisterForm(wtf.Form): first_name = wtf.TextField('First Name', validators=[validators.Required()]) last_name = wtf.TextField('Last Name', validators=[validators.Required()]) email = wtf.TextField('Email', validators=[validators.Required()]) password = wtf.PasswordField('Password', validators=[validators.Required()]) confirm = wtf.PasswordField('Confirm Password', [ validators.Required(), validators.EqualTo('password', message='Passwords must match') ])
class UserForm(wtf.Form): user_email = wtf.TextField('Email') user_first_name = wtf.TextField('First Name', validators=[validators.Required()]) user_last_name = wtf.TextField('Last Name') user_phone = wtf.TextField('Phone', validators=[validators.Required()]) user_token = wtf.TextField('Token') user_household = wtf.TextField('Household') user_house_manager = wtf.BooleanField('Household Manager') user_is_adult = wtf.BooleanField('Adult') user_is_managed = wtf.BooleanField('Managed')