예제 #1
0
파일: forms.py 프로젝트: Boomatang/Clue
    def __init__(self, company, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)
        choices = ClassList(company=company)

        choices.id = "remove"
        choices.name = "remove"
        self.check = select_multi_checkbox(choices)
예제 #2
0
 def __init__(self, *args, **kw):
     FlaskForm.__init__(self, *args, **kw)
     self.application.choices = [
         (a.id, a.name) for a in Application.query.order_by('name')
     ]
     self.service.choices = [(a.id, a.name)
                             for a in Service.query.order_by('name')]
예제 #3
0
 def __init__(self, product_choices, station_choices,
              operation_status_choices, operation_type_choices):
     Form.__init__(self)
     self.product_id.choices = product_choices
     self.station_id.choices = station_choices
     self.operation_status_id.choices = operation_status_choices
     self.operation_type_id.choices = operation_type_choices
예제 #4
0
    def __init__(self, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)

        cursor.execute('''select s.name, s.name from payment_sources s
        ''')

        self.payment_sources.choices = cursor.fetchall()
예제 #5
0
    def __init__(self, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)
        # User in session
        self.loggedInUser = kwargs['user']

        print('self.username.data: %s' % (self.username.data))
        print('self.loggedInUser.username: %s' % (self.loggedInUser.username))
예제 #6
0
 def __init__(self,
              default_license_id='CC BY-SA 3.0',
              default_language='en',
              **kwargs):
     kwargs.setdefault('license_choice', default_license_id)
     kwargs.setdefault('language', default_language)
     FlaskForm.__init__(self, **kwargs)
예제 #7
0
    def __init__(self, customer_id, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)
        self.customer_id = customer_id

        cursor.execute('''select cl.login, cl.login from customer_logins cl
        where cl.customer_id = :customer_id
        and cl.login not like '%-on'
        ''',
                       customer_id=self.customer_id)

        self.login.choices = cursor.fetchall()

        cursor.execute('''select to_char(tc.id), tc.name||' ('||s.name||')'
        from
          tariff_cards tc,
          services s,
          xxtc_tariff_params p
        where tc.service_id in (9, 49, 65)
        and s.id = tc.service_id
        and p.tariff_id = tc.id
        and p.actual_to_date > sysdate
        and p.grad_available_flag = 1
        order by tc.id desc
        ''')

        self.tariff_id.choices = cursor.fetchall()

        cursor.execute(
            '''select to_char(l.id), l.name from ip4pool_locations l''')

        self.ip4pool_location_id.choices = cursor.fetchall()
예제 #8
0
 def __init__(self, *args, **kwargs):
     if request.form and ('obj' in kwargs):
         obj = kwargs['obj']
         for field, value in request.form.items():
             if hasattr(obj, field):
                 setattr(obj, field, value)
     FlaskForm.__init__(self, *args, **kwargs)
예제 #9
0
 def __init__(self, **kwargs):
     self.validated = False
     self.success_message = None
     self.toggle_active = False
     self.render_html = {}
     self.kwargs = {}
     FlaskForm.__init__(self, **kwargs)
예제 #10
0
 def __init__(self, game, *args, **kwargs):
     FlaskForm.__init__(self, *args, **kwargs)
     self.game = game
     self.row_val = None
     self.col_val = None
     self.row.validators.append(CheckCoord(self.game))
     self.col.validators.append(CheckCoord(self.game))
예제 #11
0
 def __init__(self, tele_array, choices=choices):
     choices.clear(
     )  # necessary so updating the form won't keep doubling in length with no new data
     for telescope in tele_array:
         if telescope._C_T_calculable == True:
             choices.append(
                 (telescope.name, telescope.name.replace('_', ' ')))
     FlaskForm.__init__(self)
예제 #12
0
파일: forms.py 프로젝트: Boomatang/Clue
    def __init__(self, material_id, company):
        FlaskForm.__init__(self)
        choices = ChoicesBase(material_id)

        choices.id = "remove"
        choices.name = "remove"
        self.check = select_multi_checkbox(choices)
        self.choice.choices = material_classes(company)
예제 #13
0
 def __init__(self, user, request_method, *args, **kwargs):
     FlaskForm.__init__(self, *args, **kwargs)
     self.user = user
     if request_method == 'POST':
         self.user.username = self.username.data
         self.user.email = self.email.data
     else:
         self.username.data = self.user.username
         self.email.data = self.user.email
예제 #14
0
    def __init__(self, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)
        # self.optimizer.setChoices([('SGD','SGD'),('RMSprop','RMSprop'),('Adagrad','Adagrad'),('Adadelta','Adadelta'), \
        #             ('Adam','Adam'),('Adamax','Adamax'),('Nadam','Nadam')])

        self.optimizer.setChoices([('SGD', 'SGD')])

        self.init_mode.setChoices([('uniform','uniform'),('lecun_uniform','lecun_uniform'),('normal','normal'),('zero','zero'), \
                    ('glorot_normal','glorot_normal'),('glorot_uniform','glorot_uniform'),('he_normal','he_normal'),('he_uniform','he_uniform')])
예제 #15
0
 def __init__(self, *args, **kwargs):
     FlaskForm.__init__(self, *args, **kwargs)
     self.unit_fields = {
         "Interceptor": self.interceptor,
         "Technician": self.technician,
         "Jet": self.jet,
         "Soldier": self.soldier,
         "Drone": self.drone,
         "Cruiser": self.cruiser
     }
예제 #16
0
 def __init__(self, *args, **kwargs):
     FlaskForm.__init__(self, *args, **kwargs)
     self.resource_fields = {
         "Platin": self.platin,
         "Plasma": self.plasma,
         "Energie": self.energie,
         "Plasmid": self.plasmid,
         "Stahl": self.stahl,
         "Nahrung": self.nahrung
     }
예제 #17
0
    def __init__(self, ac):
        FlaskForm.__init__(self, obj=ac)

        if self.start_date.data is None and self.start_time.data is None:
            self.start_date.data, self.start_time.data = split_ts(ac.start)

        if self.end_date.data is None and self.end_time.data is None:
            self.end_date.data, self.end_time.data = split_ts(ac.end)

        self.assoc_obj = ac
예제 #18
0
 def __init__(self, flaskApp: Flask, *args, **kwargs):
     FlaskForm.__init__(self, *args, **kwargs)
     UserManager.__init__(self, flaskApp)
     cls = self.__class__  # get reference to cls
     cls.username = StringField('Username', validators=[DataRequired()])
     cls.password = PasswordField('Password',
                                  validators=[
                                      DataRequired(), self.validateUsername,
                                      self.validatePassword
                                  ])
예제 #19
0
 def __init__(self, *args, **kwargs):
     self.instructors.kwargs['choices'] = [
         (item['name'], item['name']) for item in mongo.db['users'].find()
     ]
     self.terms.kwargs['choices'] = [(item, item) for item in [
         'FALL', 'SPRING', 'J_TERM', 'SUMMER SESSION I', 'SUMMER SESSION II'
     ]]
     self.owner.kwargs['choices'] = [(item['name'], item['name'])
                                     for item in mongo.db['users'].find()]
     FlaskForm.__init__(self, *args, **kwargs)
예제 #20
0
 def __init__(self, **kwargs):
     self.validated = False
     self.success_message = None
     self.field_values = {}
     try:
         self.user_input_fields
     except:
         self.user_input_fields = []
     for field in self.user_input_fields:
         self.field_values.update({field: None})
     FlaskForm.__init__(self, **kwargs)
예제 #21
0
 def __init__(self, *args, **kwargs):
     self.dept.kwargs['choices'] = [(item['abbrev'], item['name'])
                                    for item in mongo.db.depts.find()]
     self.chair.kwargs['choices'] = [('APC', 'APC')]
     self.chair.kwargs['choices'].extend([
         (item['abbrev'], item['name']) for item in mongo.db.depts.find()
     ])
     self.chair.kwargs['choices'].extend([
         (item, item) for item in mongo.db.depts.find().distinct('division')
     ])
     FlaskForm.__init__(self, *args, **kwargs)
예제 #22
0
    def __init__(self, customer_id, login, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)
        self.customer_id = customer_id
        self.login = login

        cursor.execute('''select a.nm_, a.nm_ from available_tc a
        where a.login = :login
        order by a.nm_
        ''',
                       login=self.login)

        self.next_tc_id.choices = cursor.fetchall()
예제 #23
0
파일: edit.py 프로젝트: CS-Center/CS-Center
    def __init__(self, article):
        FlaskForm.__init__(self)
        self.assoc_obj = article

        if self.nid.data is None:
            self.nid.data = article.nid

        if self.title.data is None:
            self.title.data = article.title

        if self.body.data is None:
            self.body.data = article.body
예제 #24
0
 def __init__(self, *args, **kwargs):
     if "project" in kwargs:
         project = kwargs["project"]
         FlaskForm.__init__(self,
                            name=project.name,
                            id=project.id,
                            *args,
                            **kwargs)
         self.nametext = project.name
         self.donations = project.donations
         self.delform = DeleteProjectForm(id=project.id)
     else:
         FlaskForm.__init__(self, *args, **kwargs)
예제 #25
0
    def __init__(self, party_id, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)

        cursor.execute('''select to_char(p.id), p.name from party_params p
        where not exists (
          select 1
          from party_param_vals v
            where v.party_id = :party_id
            and v.party_param_id = p.id
        )
        order by p.name
        ''',
                       party_id=party_id)
        self.param_id.choices = cursor.fetchall()
예제 #26
0
    def __init__(self, leaf_id):
        FlaskForm.__init__(self)
        self.dispositivo_condicao.choices = []
        dispositivos = Dispositivo.query.filter_by(leaf_id=leaf_id).all()
        for dispositivo in dispositivos:
            self.dispositivo_condicao.choices.append(
                (str(dispositivo.id_dispositivo), dispositivo.nome))

        self.dispositivo_atuador.choices = []
        atuadores = Dispositivo.query.filter_by(
            leaf_id=leaf_id).filter((Dispositivo.tipo == 'potenciometro') | (
                Dispositivo.tipo == 'interruptor')).all()
        for atuador in atuadores:
            self.dispositivo_atuador.choices.append(
                (str(atuador.id_dispositivo), atuador.nome))
예제 #27
0
    def __init__(self, lesson):
        FlaskForm.__init__(self)
        self.assoc_obj = lesson

        if self.lid.data is None:
            self.lid.data = lesson.lid

        if self.title.data is None:
            self.title.data = lesson.title

        if self.desc.data is None:
            self.desc.data = lesson.desc

        if self.body.data is None:
            self.body.data = lesson.body
예제 #28
0
    def __init__(self, all_players, *args, **kwargs):
        """ Requires init so that all_players can be part in the class and checked against during validation
        to ensure the right number of players are checked. This logic counts any guests specified as well.

        Parameters
        ----------

        all_players : `list` of `str`
            Should be set against the current list of all other player names. Make sure the entered player name is not
            in this list.
        *args : *args
            Passed through to the FlaskForm
        **kwargs : **kwargs
            Passed through to the FlaskForm

        """
        FlaskForm.__init__(self, *args, **kwargs)

        self.allPlayersExceptMe = all_players
예제 #29
0
    def __init__(self, customer_id, *args, **kwargs):
        FlaskForm.__init__(self, *args, **kwargs)
        self.customer_id = customer_id

        cursor.execute('''select cl.login, cl.login from customer_logins cl
        where cl.customer_id = :customer_id
        and cl.login not like '%-on'
        ''',
                       customer_id=self.customer_id)

        self.login.choices = cursor.fetchall()

        cursor.execute('''select f.class, f.class from tariff_amount_fee f
        where f.tariff_card = 9
        and f.class is not null
        order by f.id
        ''')

        self.service.choices = cursor.fetchall()
예제 #30
0
 def __init__(self, outer_page_instance=None, style=None, *args, **kwargs):
     fondum_utility.handle_form_imports(self)
     FlaskForm.__init__(self, *args, **kwargs)
     self.page = outer_page_instance
     self._form_style = style or FORM_STYLES[0]
     #
     # reorder fields
     #
     if hasattr(self, "_field_order"):
         fields = collections.OrderedDict()
         starting_keys = self._fields.keys()
         for key in self._field_order:
             if key not in starting_keys:
                 raise (KeyError(
                     "Cannot find '{}' (from _field_order) in PageForm fields."
                     .format(key)))
             fields[key] = self._fields[key]
         if 'csrf_token' not in fields:
             fields['csrf_token'] = self._fields['csrf_token']
         self._fields = fields
예제 #31
0
파일: forms.py 프로젝트: opatut/dudel
 def __init__(self, *args, **kwargs):
     self._form_name = type(self).__name__
     FlaskForm.__init__(self, *args, **kwargs)
예제 #32
0
 def __init__(self, default_license_id='CC BY-SA 3.0', default_language='en', **kwargs):
     kwargs.setdefault('license_choice', default_license_id)
     kwargs.setdefault('language', default_language)
     FlaskForm.__init__(self, **kwargs)
예제 #33
0
	def __init__(self, original_username, *args, **kwargs):
		Form.__init__(self, *args, **kwargs)
		self.original_username = original_username
예제 #34
0
 def __init__(self, review_id=None, **kwargs):
     kwargs['review_id'] = review_id
     FlaskForm.__init__(self, **kwargs)
예제 #35
0
 def __init__(self, entity_id=None, entity_type=None, **kwargs):
     kwargs['entity_id'] = entity_id
     kwargs['entity_type'] = entity_type
     FlaskForm.__init__(self, **kwargs)
예제 #36
0
 def __init__(self, *args, **kwargs):
     FlaskForm.__init__(self, *args, **kwargs)
     self.desired_state = DoorState.Closed
예제 #37
0
파일: forms.py 프로젝트: chamambom/oculus
 def __init__(self, *args, **kwargs):
     FlaskForm.__init__(self, *args, **kwargs)
예제 #38
0
파일: forms.py 프로젝트: JARR/JARR
 def __init__(self, *args, **kwargs):
     FlaskForm.__init__(self, *args, **kwargs)
     if not self.next.data:
         self.next.data = misc_utils.get_redirect_target() or ''