Ejemplo n.º 1
0
    def setup_jinja(self):
        page_title = "Registration"
        year_list = array('i', range(1900, date.today().year))

        template_values = {
            'page_title': page_title,
            'user_id': main.current_user().email(),
            'is_registered': main.is_registered(),
            'year_list': year_list,
            'postcode_list': self.postcode_list(),
        }

        template = JINJA_ENVIRONMENT.get_template('templates/registration.html')
        self.response.write(template.render(template_values))
Ejemplo n.º 2
0
    def post(self):
        new_user = RateItUser()
        new_user.user = main.current_user()
        new_user.user_type = "passenger"
        new_user.user_sex = self.request.get('sex').lower()
        new_user.user_born_year = self.request.get('inputYear')
        new_user.user_household_type = self.request.get('householdType')
        new_user.user_postcode = self.request.get('postcode')
        new_user.user_education = self.request.get('education')
        new_user.user_occupation = self.request.get('occupation')
        new_user.user_monthly_income = self.request.get('monthly_income')
        new_user.user_mobility_impairment = self.request.get('mobility_impairment')
        new_user.user_often_use = self.request.get('often_to_use')
        new_user.user_device = self.request.get('devices_type')
        new_user.user_driver_licence = self.request.get('drivers_licence')
        new_user.user_purpose_use = self.request.get('purpose_to_use')
        new_user.time_registered = datetime.today()


        if not main.is_registered():
            new_user.put()

        self.setup_jinja()
        self.redirect(main.get_pre_page())