def get(self, range_id, model_id): template = JINJA_ENVIRONMENT.get_template( 'templates/carmodels/model_detail.html') model_range = ModelRange.get(range_id) car_model = CarModel.get(model_id) data = {'range': model_range, 'model': car_model} self.response.write(template.render(data))
def get(self, range_id, model_id): template = JINJA_ENVIRONMENT.get_template('templates/carmodels/model_detail.html') model_range = ModelRange.get(range_id) car_model = CarModel.get(model_id) data = { 'range': model_range, 'model': car_model } self.response.write(template.render(data))
def post(self): import datetime car_key = self.request.get('car_key') model_key = self.request.get('model_key') car = Car.get(car_key) car.model = CarModel.get(model_key) car.notes = '' car.put() print 'Updated car model to',car.model.name ts = datetime.datetime.now() return self.redirect('/caredit?tag='+str(ts.time().microsecond))
def post(self): import datetime car_key = self.request.get('car_key') model_key = self.request.get('model_key') car = Car.get(car_key) car.model = CarModel.get(model_key) car.notes = '' car.put() print 'Updated car model to', car.model.name ts = datetime.datetime.now() return self.redirect('/caredit?tag=' + str(ts.time().microsecond))
def post(self, range_id, model_id): model_range = ModelRange.get(range_id) if self.request.get('cancel') == '1': return self.redirect('/ranges/' + str(model_range.key()) + '/edit') model = CarModel.get(model_id) model.name = self.request.get('name') model.year_from = int(self.request.get('yearfrom')) model.year_to = int(self.request.get('yearto')) model.typeno = self.request.get('tipo') model.engine_code = self.request.get('engine') url = self.request.get('image_url') if url != '': model.image_url = db.Link(url) model.notes = self.request.get('notes') model.put() return self.redirect('/ranges/' + str(model_range.key()) + '/edit')
def post(self, member_id, car_id): if self.request.get('cancel') == '1': return self.redirect('/members/' + member_id + '/edit') car = Car.get(car_id) car.registration = self.request.get('registration') yearstr = self.request.get('year') year = 0 if yearstr != '': year = int(self.request.get('year')) if year > 0: car.year = year else: car.year = None yearstr = self.request.get('bought') year = 0 if yearstr != '': year = int(self.request.get('bought')) if year > 0: car.bought_year = year else: car.bought_year = None yearstr = self.request.get('sold') year = 0 if yearstr != '': year = int(self.request.get('sold')) if year > 0: car.sold_year = year else: car.sold_year = None model_key = self.request.get('model_key') if not car.model or not str(car.model.key()) == model_key: car.model = CarModel.get(model_key) car.serial_no = self.request.get('serial_no') car.notes = self.request.get('note') car.put() return self.redirect('/members/' + member_id + '/edit')