Exemple #1
0
 def __init__(self, current_user, current_problem, *args, **kwargs):
     if current_user.is_authenticated():
         self.current_user_id = current_user.id
     else:
         self.current_user_id = None
     self.current_problem_id = current_problem.id
     Form.__init__(self, *args, **kwargs)
Exemple #2
0
 def __init__(self, *args, **kwargs):
     kwargs['csrf_enabled'] = False
     Form.__init__(self, *args, **kwargs)
     self.answer = None
     self.question_id = None
     self.userid1 = None
     self.userid2 = None
Exemple #3
0
 def __init__(self, user=None):
     Form.__init__(self)
     if user:
         self.user = user
         self.first_name.data = self.user.first_name
         self.last_name.data = self.user.last_name
         self.email.data = self.user.email
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     # Possible groups a user can choose from are loaded into the permitted select
     groups = Group.query.filter(User.user_name == current_user.user_name, Group.group_name != "private").all()
     group_private = Group.query.filter(Group.group_name == "private").all()
     # Put the private group first
     self.permitted.choices = [(group.group_id, group.group_name) for group in group_private + groups]
     self.image_obj = None
Exemple #5
0
 def __init__(self, *args, **kwargs):
     """Initialize the ChangeDateAndDepartmentForm object"""
     Form.__init__(self, *args, **kwargs)
     self.ds = None
     self.dept_id = None
     self.department.choices = [
         (dept.id, dept.name) for dept in Department.query.all()
     ]
Exemple #6
0
 def __init__(self, member=None):
     Form.__init__(self)
     self.roles.choices = [(role.id, role.name) for role in Role.query.all()]
     self.member = member
     if self.member:
         self.first_name.data = self.member.first_name
         self.last_name.data = self.member.last_name
         self.email.data = self.member.email
         self.roles.data = [role.id for role in self.member.roles]
Exemple #7
0
    def __init__(self, *args, **kwargs):
        """

        :param args:
        :param kwargs:
        :return:
        """
        Form.__init__(self, *args, **kwargs)
        self.user = None
Exemple #8
0
    def __init__(self, place, *a, **kw):
        Form.__init__(self, *a, **kw)
        self.place = place
        self.level.choices = [(t.short_name, t.name) for t in models.PlaceType.all()]

        # Ensure that there are at least 5 empty slots
        empty_slots = sum(1 for role in self.data['roles'] if not role['name'].strip())
        for i in range(5-empty_slots):
            self.roles.append_entry()
Exemple #9
0
    def __init__(self, *args, **kwargs):
        Form.__init__(self, *args, **kwargs)
        self.stop_id = kwargs['stop_id']
        self.ip = kwargs['ip']
        self.timestamp = kwargs['timestamp']

        if kwargs['stop_name']:
            self.stop_name = kwargs['stop_name']
        else:
            self.stop_name = "glargh"
Exemple #10
0
    def __init__(self, *args, **kwargs):
        Form.__init__(self, *args, **kwargs)

        # Load subjects and users from database to populate select options
        users = ["All Users"] + [user.user_name for user in User.query.order_by(User.user_name).all()]

        image_query = Image.query.group_by(Image.subject).order_by(Image.subject).all()
        subjects = ["All Subjects"] + [image.subject for image in image_query]

        self.subject.choices = [["No Subjects", "Any Subject"]] + list(zip(subjects, subjects))
        self.user.choices = [["No Users", "Any User"]] + list(zip(users, users))
Exemple #11
0
 def __init__(self, user=None, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     if user:
         self.email.data = user.email
         self.name.data = user.name
         self.nickname.data = user.nickname
         self.role_id.data = user.role_id
         self.address.data = user.address
         self.phone.data = user.phone
         self.timezone.data = user.timezone
         self.lang.data = user.lang
Exemple #12
0
 def __init__(self, post=None, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     self.category_id.choices = Category.get_list()
     if post:
         self.id = kwargs.get("id") if kwargs.get("id") else 0
         self.title.data = post.title
         self.body.data = post.body
         self.extra_body.data = post.extra_body
         self.anonymous.data = post.anonymous
         self.category_id.data = post.category_id
         self.cover_picture_id.data = post.cover_picture_id
Exemple #13
0
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     obj = kwargs.get('obj', False)
     if obj:
         self.title.data = obj.get('title', None)
         self.description.data = obj.get('description', None)
         self.uri.data = obj.get('uri', None)
         # only json dump if there's a value... cuz json'll make it null
         # and then cause it to be saved later as 'ids':'null'
         self.ids.data = json.dumps(obj.get('ids', None)) if obj.get('ids', None) else obj.get('ids', None)
         self.ctype.data = obj.get('type', None)
         self.levels.data = json.dumps(obj.get('levels', None)) if obj.get('levels', None) else obj.get('levels', None)
         self.relations.data = json.dumps(obj.get('relations', None)) if obj.get('relations', None) else obj.get('relations', None)
         self.linked_content.data = json.dumps(obj.get('linked_content', None)) if obj.get('linked_content', None) else obj.get('linked_content', None)
Exemple #14
0
 def __init__(self, page=None):
     Form.__init__(self)
     self.page = page
     self.templates.choices = [(t.id, t.name) for t in Template.query.all()]
     self.templates.coerce = int
     if self.page:
         self.slug.data = page.slug
         self.title.data = page.title
         self.description.data = page.description
         self.content.data = page.content
         self.login_required.data = page.login_required
         self.show_in_nav.data = page.show_in_nav
         self.templates.data = page.template_id
         self.header_image.data = page.header_image
Exemple #15
0
	def __init__(self, original_nickname, *args, **kwargs):
		Form.__init__(self, *args, **kwargs)
		self.original_nickname = original_nickname
Exemple #16
0
 def __init__(self, *args, **kwargs):
     """Initialize the DownloadReportForm object"""
     Form.__init__(self, *args, **kwargs)
     self.start = None
     self.end = None
Exemple #17
0
 def __init__(self, *args, **kwargs):
     """Initialize the SearchForm object"""
     Form.__init__(self, *args, **kwargs)
     self.reports = []
Exemple #18
0
 def __init__(self, *args, **kwargs):
     """Initialize the registration form"""
     Form.__init__(self, *args, **kwargs)
     self.pw_reset = None
Exemple #19
0
	def __init__(self, *args,**kwargs):
		Form.__init__(self,*args,**kwargs)
		self.access_token = None
		self.user = None
		self.validate()
Exemple #20
0
 def __init__(self, *args, **kwargs):
     """Initialize the create chart form"""
     Form.__init__(self, *args, **kwargs)
     self.chart = None
Exemple #21
0
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
Exemple #22
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)
    Form.__init__(self, **kwargs)
Exemple #23
0
 def __init__(self, variant_choices):
     Form.__init__(self)
     self.variant_id.choices = variant_choices
Exemple #24
0
 def __init__(self, type_choices):
     Form.__init__(self)
     self.type.choices = type_choices
 def __init__(self, *args, **kwargs):
     """Constructor. Not used???"""
     Form.__init__(self, *args, **kwargs)
     self.user = None
Exemple #26
0
 def __init__(self, formdata=None, *a, **kw):
     if formdata is not None and not hasattr(formdata, 'getall'):
         formdata = MultiDict(formdata)
     BaseForm.__init__(self, formdata, *a, **kw)
Exemple #27
0
 def __init__(self, *args, **kwargs):
     """Initialize the ChangeDateForm object"""
     Form.__init__(self, *args, **kwargs)
     self.ds = None
Exemple #28
0
 def __init__(self, place, *a, **kw):
     Form.__init__(self, *a, **kw)
     self._place = place
     self._setup_booth_options()
Exemple #29
0
 def __init__(self,*args,**kwargs):
     Form.__init__(self, *args, **kwargs)
     self.validate()
Exemple #30
0
 def __init__(self, *args, **kwargs):
     """Initialize the submit report data form"""
     Form.__init__(self, *args, **kwargs)
     self.data_points = []
     self.stale_values = []
Exemple #31
0
 def __init__(self, user_id, *args, **kwargs):
   """
   Store the original user_id to verify against to check uniqueness.
   """
   Form.__init__(self, *args, **kwargs) # originally: Form.__init__(self, *args, **kwargs):
   self.user_id = user_id
Exemple #32
0
 def __init__(self, *args, **kwargs):
     self._form_name = type(self).__name__
     Form.__init__(self, *args, **kwargs)
Exemple #33
0
 def __init__(self, place=None, *a, **kw):
     Form.__init__(self, *a, **kw)
     self._place = place
Exemple #34
0
 def __init__(self, *args, **kwargs):
     """Initialize the form"""
     Form.__init__(self, *args, **kwargs)
Exemple #35
0
 def __init__(self, formdata=None, *a, **kw):
     if formdata is not None and not hasattr(formdata, 'getall'):
         formdata = MultiDict(formdata)
     BaseForm.__init__(self, formdata, *a, **kw)
Exemple #36
0
 def __init__(self):
     Form.__init__(self)
     self.widgets.choices = [(w.id, w.name) for w in Widget.query.all()]
Exemple #37
0
 def __init__(self, default_email=None, **kwargs):
     kwargs.setdefault('contact_email', default_email)
     Form.__init__(self, **kwargs)
Exemple #38
0
 def __init__(self, *args, **kwargs):
     """Initialize the registration form"""
     Form.__init__(self, *args, **kwargs)
     self.user = None
     self.allergies = None
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     self.date1 = None
     self.date2 = None
Exemple #40
0
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     self.location.choices = [ (str(l.id), l.name) for l in labevents.database.Session().query(Location).all() ]
Exemple #41
0
 def __init__(self, *args, **kwargs):
     """Initialize the edit report form"""
     Form.__init__(self, *args, **kwargs)
     self.report = None
Exemple #42
0
 def __init__(self, place, *a, **kw):
     Form.__init__(self, *a, **kw)
     self._place = place
     self.ac.data = place.get_parent("AC").name
Exemple #43
0
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     if 'post_id' in kwargs:
         self.post_id = kwargs['post_id']
     else:
         self.post_id = None
Exemple #44
0
 def __init__(self, place, *a, **kw):
     Form.__init__(self, *a, **kw)
     self._place = place
     self._setup_booth_options()
Exemple #45
0
 def __init__(self, data, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     if 'name' in data:
         self.name.data = data['name']
     if 'surname' in data:
         self.surname.data = data['surname']
Exemple #46
0
    def __init__(self, ):
        Form.__init__(self)

        from sonic_app.app import app
        self.model.choices = [(m, m) for m in app.config.get('PI_MODELS')]
Exemple #47
0
 def __init__(self):
     Form.__init__(self, csrf_enabled=True)
Exemple #48
0
 def __init__(self, review_id=None, **kwargs):
     kwargs['review_id'] = review_id
     Form.__init__(self, **kwargs)
Exemple #49
0
    def __init__(self, obj=None, prefix='', **kwargs):
        Form.__init__(self, obj=obj, prefix=prefix, **kwargs)

        self._obj = obj
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     if not self.next.data:
         self.next.data = get_redirect_target() or ''
Exemple #51
0
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     self.user = None
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     self.name = None
Exemple #53
0
 def __init__(self, original_nickname, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     self.original_nickname = original_nickname
Exemple #54
0
	def __init__(self, *args, **kwargs):
		Form.__init__(self, *args, **kwargs)
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     if not self.next.data:
         self.next.data = get_redirect_target() or ''
Exemple #56
0
 def __init__(self, *args, **kwargs):
     Form.__init__(self, *args, **kwargs)
     self.user = None
Exemple #57
0
 def __init__(self, place=None, *a, **kw):
     Form.__init__(self, *a, **kw)
     self._place = place