Esempio n. 1
0
 def get(self):
     path = os.path.join(os.path.dirname(__file__),
                         'template/under_construction.html')
     template_values = makeUserLinks(self.request.uri)
     template_values['menu'] = makeMenu()
     template_values['message'] = 'Requested page not found'
     self.response.out.write(template.render(path, template_values))
Esempio n. 2
0
    def post(self):
        try:
            id = int(self.request.get('_id'))
            bike = Bike.get(db.Key.from_path('Bike', id))
        except ValueError:
            bike = None
            id = None
        data = BikeForm(data=self.request.POST, instance=bike)

        if data.is_valid():
            # Save and redirect to admin home page
            entity = data.save(commit=False)
            entity.bikeRider = users.get_current_user()
            entity.put()
            self.redirect('/user/bikeoverview')
        else:
            # back to form for editing
            path = os.path.join(os.path.dirname(__file__),
                                'template/bikeentry.html')
            template_values = makeUserLinks(self.request.uri)
            template_values['menu'] = makeMenu(page='user/bikeentry')
            template_values['submitValue'] = 'Fix'
            template_values['form'] = data
            template_values['id'] = id
            self.response.out.write(template.render(path, template_values))
Esempio n. 3
0
    def post(self):
        try:
            id = int(self.request.get('_id'))
            bikeRide = BikeRide.get(db.Key.from_path('BikeRide', id))
        except ValueError:
            bikeRide = None
            id = None
        data = BikeRideForm(data=self.request.POST, instance=bikeRide)
        logging.info("data from bikeride form is: %s", data)
        logging.info("data from the bikeride request is: %s", self.request)

        if data.is_valid():
            entity = data.save(commit=False)
            entity.bikeRider = users.get_current_user()
            entity.put()
            self.redirect('/user/rideroverview')
        else:
            path = os.path.join(os.path.dirname(__file__),
                                'template/rideentry.html')
            template_values = makeUserLinks(self.request.uri)
            template_values['menu'] = makeMenu(page='user/rideentry')
            template_values['submitValue'] = 'Fix'
            template_values['form'] = data
            template_values['id'] = id
            self.response.out.write(template.render(path, template_values))
Esempio n. 4
0
 def get(self):
     path = os.path.join(os.path.dirname(__file__),
                         'template/rideroverview.html')
     template_values = makeUserLinks(self.request.uri)
     template_values['menu'] = makeMenu(page='user/rideroverview')
     template_values['rides'] = BikeRide.gql(
         'where bikeRider = :1 order by date desc',
         users.get_current_user()).fetch(limit=10)
     self.response.out.write(template.render(path, template_values))
Esempio n. 5
0
 def get(self):
     path = os.path.join(os.path.dirname(__file__),
                         'template/bikeoverview.html')
     template_values = makeUserLinks(self.request.uri)
     template_values['menu'] = makeMenu(page='user/bikeoverview')
     template_values['bikes'] = Bike.all().filter('bikeRider = ',
                                                  users.get_current_user())
     template_values['biketypes'] = BikeType.all()
     self.response.out.write(template.render(path, template_values))
Esempio n. 6
0
    def get(self):
        template_values = makeUserLinks(self.request.uri)
        try:
            id = int(self.request.get('id'))
            bike = Bike.get(db.Key.from_path('Bike', id))
            template_values['submitValue'] = 'Update'
        except ValueError:
            id = None
            bike = None
            template_values['submitValue'] = 'Create'

        path = os.path.join(os.path.dirname(__file__),
                            'template/bikeentry.html')
        template_values['menu'] = makeMenu(page='user/bikeentry')
        template_values['form'] = BikeForm(instance=bike)
        template_values['id'] = id
        self.response.out.write(template.render(path, template_values))
Esempio n. 7
0
 def get(self):
     path = os.path.join(os.path.dirname(__file__), 'template/welcome.html')
     template_values = makeUserLinks(self.request.uri)
     template_values['menu'] = makeMenu('')
     self.response.out.write(template.render(path, template_values))