def __init__(self): super(SearchRequestsForm, self).__init__() self.agency_ein.choices = get_agency_choices() self.agency_ein.choices.insert(0, ('', 'All')) if current_user.is_agency: self.agency_ein.default = current_user.default_agency_ein user_agencies = sorted([(agencies.ein, agencies.name) for agencies in current_user.agencies if agencies.ein != current_user.default_agency_ein], key=lambda x: x[1]) default_agency = current_user.default_agency # set default value of agency select field to agency user's primary agency self.agency_ein.default = default_agency.ein self.agency_ein.choices.insert(1, self.agency_ein.choices.pop(self.agency_ein.choices.index( (default_agency.ein, default_agency.name)) )) # set secondary agencies to be below the primary for agency in user_agencies: self.agency_ein.choices.insert(2, self.agency_ein.choices.pop(self.agency_ein.choices.index(agency))) # get choices for agency user select field if current_user.is_agency_admin(): self.agency_user.choices = get_active_users_as_choices(current_user.default_agency.ein) if current_user.is_agency_active() and not current_user.is_agency_admin(): self.agency_user.choices = [ ('', 'All'), (current_user.get_id(), 'My Requests') ] self.agency_user.default = current_user.get_id() # process form for default values self.process()
def __init__(self): super(SearchRequestsForm, self).__init__() self.agency_ein.choices = get_agency_choices() self.agency_ein.choices.insert(0, ("", "All")) if current_user.is_agency: self.agency_ein.default = current_user.default_agency_ein user_agencies = sorted( [(agencies.ein, agencies.name) for agencies in current_user.agencies if agencies.ein != current_user.default_agency_ein], key=lambda x: x[1], ) default_agency = current_user.default_agency # set default value of agency select field to agency user's primary agency self.agency_ein.default = default_agency.ein self.agency_ein.choices.insert( 1, self.agency_ein.choices.pop( self.agency_ein.choices.index( (default_agency.ein, default_agency.name))), ) # set secondary agencies to be below the primary for agency in user_agencies: self.agency_ein.choices.insert( 2, self.agency_ein.choices.pop( self.agency_ein.choices.index(agency)), ) # get choices for agency user select field if current_user.is_agency_admin(): self.agency_user.choices = get_active_users_as_choices( current_user.default_agency.ein) if current_user.is_agency_active( ) and not current_user.is_agency_admin(): self.agency_user.choices = [ ("", "All"), (current_user.get_id(), "My Requests"), ] self.agency_user.default = current_user.get_id() if default_agency.agency_features["custom_request_forms"][ "enabled"]: self.request_type.choices = [ (custom_request_form.form_name, custom_request_form.form_name) for custom_request_form in CustomRequestForms.query. filter_by(agency_ein=default_agency.ein).order_by( asc(CustomRequestForms.category), asc(CustomRequestForms.id)).all() ] self.request_type.choices.insert(0, ("", "All")) # process form for default values self.process()
def __init__(self): super(ReportFilterForm, self).__init__() self.agency.choices = get_agency_choices() self.agency.choices.insert(0, ('all', 'All')) self.user.choices = [] if current_user.is_agency: user_agencies = sorted([(agencies.ein, agencies.name) for agencies in current_user.agencies], key=lambda x: x[1]) for user_agency in user_agencies: self.agency.choices.insert(1, self.agency.choices.pop(self.agency.choices.index(user_agency)))
def __init__(self): super(ReportFilterForm, self).__init__() self.agency.choices = get_agency_choices() self.agency.choices.insert(0, ('all', 'All')) self.user.choices = [] if current_user.is_agency: user_agencies = sorted([(agencies.ein, agencies.name) for agencies in current_user.agencies], key=lambda x: x[1]) for user_agency in user_agencies: self.agency.choices.insert( 1, self.agency.choices.pop( self.agency.choices.index(user_agency)))
def __init__(self): super(SearchRequestsForm, self).__init__() self.agency_ein.choices = get_agency_choices() self.agency_ein.choices.insert(0, ('', 'All')) # set default value of agency select field to agency user's agency if current_user.is_agency: self.agency_ein.default = current_user.default_agency_ein user_agencies = sorted([(agencies.ein, agencies.name) for agencies in current_user.agencies], key=lambda x: x[1]) for agency in user_agencies: self.agency_ein.choices.insert( 1, self.agency_ein.choices.pop( self.agency_ein.choices.index(agency))) self.process()
def __init__(self): super(SearchRequestsForm, self).__init__() self.agency_ein.choices = get_agency_choices() self.agency_ein.choices.insert(0, ("", "All")) if current_user.is_agency: self.agency_ein.default = current_user.default_agency_ein user_agencies = sorted( [(agencies.ein, agencies.name) for agencies in current_user.agencies if agencies.ein != current_user.default_agency_ein], key=lambda x: x[1], ) default_agency = current_user.default_agency # set default value of agency select field to agency user's primary agency self.agency_ein.default = default_agency.ein self.agency_ein.choices.insert( 1, self.agency_ein.choices.pop( self.agency_ein.choices.index( (default_agency.ein, default_agency.name))), ) # set secondary agencies to be below the primary for agency in user_agencies: self.agency_ein.choices.insert( 2, self.agency_ein.choices.pop( self.agency_ein.choices.index(agency)), ) # get choices for agency user select field if current_user.is_agency_admin(): self.agency_user.choices = get_active_users_as_choices( current_user.default_agency.ein) if current_user.is_agency_active( ) and not current_user.is_agency_admin(): self.agency_user.choices = [ ("", "All"), (current_user.get_id(), "My Requests"), ] self.agency_user.default = current_user.get_id() # process form for default values self.process()
def __init__(self): super(PublicUserRequestForm, self).__init__() self.request_agency.choices = get_agency_choices() self.request_agency.choices.insert(0, ("", ""))
def __init__(self): super(AnonymousRequestForm, self).__init__() self.request_agency.choices = get_agency_choices() self.request_agency.choices.insert(0, ("", ""))
def __init__(self): super(PublicUserRequestForm, self).__init__() self.request_agency.choices = get_agency_choices() self.request_agency.choices.insert(0, ('', ''))
def __init__(self): super(AnonymousRequestForm, self).__init__() self.request_agency.choices = get_agency_choices() self.request_agency.choices.insert(0, ('', ''))
def __init__(self): super(AddAgencyUserForm, self).__init__() self.agency.choices = get_agency_choices() self.agency.choices.insert(0, ('', ''))
def __init__(self): super(ReportFilterForm, self).__init__() self.agency.choices = get_agency_choices() self.agency.choices.insert(0, ('all', 'All')) self.user.choices = []
def __init__(self): super(SearchRequestsForm, self).__init__() self.agency_ein.choices = get_agency_choices() self.agency_ein.choices.insert(0, ('', 'All'))