Exemple #1
0
 def get(self):
     user = users.get_current_user()
     p_obj = permissions.Permissions()
     userTypes = p_obj.getPermissions(user.email())
     if userTypes[1] == 1:
         self.redirect('/owner-home')
         return
     template = jinja_environment.get_template('register_owner.html')
     cities_obj = Cities()
     my_cities = cities_obj.getCitiesFromDb()
     parameters_for_template = {'user': user, 'cities': my_cities}
     self.response.write(template.render(parameters_for_template))
Exemple #2
0
 def get(self):
     user = users.get_current_user()
     p_obj = permissions.Permissions()
     userTypes = p_obj.getPermissions(user.email())
     if userTypes[0] != 1:  #UPDATE TO CHECK IN DB
         parameters_for_template = {
             'message':
             'You don\'t have permissions to this page. Please try again later'
         }
         template = jinja_environment.get_template('error_page.html')
         self.response.write(template.render(parameters_for_template))
     else:
         cities_obj = Cities()
         my_owner_finder = owner_finder.OwnerFinder()
         my_cities = cities_obj.getCitiesFromDb()
         owners = my_owner_finder.getAllOwners('', 0, 0, user.email(), True)
         parameters_for_template = {
             'user': user,
             'cities': my_cities,
             'owners': owners
         }
         template = jinja_environment.get_template('filter_owners.html')
         self.response.write(template.render(parameters_for_template))
Exemple #3
0
    def get(self):
        user = users.get_current_user()
        p_obj = permissions.Permissions()
        userTypes = p_obj.getPermissions(user.email())
        if userTypes[0] != 1:
            parameters_for_template = {
                'message':
                'You don\'t have permissions to this page. Please try again later'
            }
            template = jinja_environment.get_template('error_page.html')
            self.response.write(template.render(parameters_for_template))
        else:
            city = self.request.get('city')
            minAge = self.request.get('minAge')
            maxAge = self.request.get('maxAge')
            viewAll = True if self.request.get('all') == 'on' else False
            logging.error(viewAll)
            my_owner_finder = owner_finder.OwnerFinder()
            if viewAll:
                owners = my_owner_finder.getAllOwners('', 0, 0, user.email(),
                                                      viewAll)
            else:
                owners = my_owner_finder.getAllOwners(city, minAge, maxAge,
                                                      user.email(), viewAll)

        logging.error(owners)
        cities_obj = Cities()
        my_cities = cities_obj.getCitiesFromDb()
        my_cities.insert(0, 'All Cities')
        parameters_for_template = {
            'cities': my_cities,
            'user': user,
            'owners': owners
        }
        template = jinja_environment.get_template('filter_owners.html')
        self.response.write(template.render(parameters_for_template))