示例#1
0
    def get(self):
        driver = int(self.request.get("edit"))
        edit_driver = Driver.get_by_id(driver)

        t = jinja_env.get_template("driveredit.html")
        content = t.render(driver=edit_driver)
        self.write(content)
示例#2
0
    def post(self):
        general_checkbox = self.request.get("general")
        oil_checkbox = self.request.get("oil")
        coolant_checkbox = self.request.get("coolant")
        belts_checkbox = self.request.get("belts")
        battery_checkbox = self.request.get("battery")
        engine_checkbox = self.request.get("engine")
        gauges_checkbox = self.request.get("gauges")
        wipers_checkbox = self.request.get("wipers")
        horn_checkbox = self.request.get("horn")
        heat_checkbox = self.request.get("heat")
        mirrors_checkbox = self.request.get("mirrors")
        steering_checkbox = self.request.get("steering")
        brakes_checkbox = self.request.get("brakes")
        ebrake_checkbox = self.request.get("ebrake")
        seatbelts_checkbox = self.request.get("seatbelts")
        safety_checkbox = self.request.get("safety")
        lights_checkbox = self.request.get("lights")
        reflectors_checkbox = self.request.get("reflectors")
        suspension_checkbox = self.request.get("suspension")
        tires_checkbox = self.request.get("tires")
        exhaust_checkbox = self.request.get("exhaust")
        wheels_checkbox = self.request.get("wheels")
        exbrakes_checkbox = self.request.get("exbrakes")
        action_checkbox = self.request.get("action")
        form_num = self.request.get("formnum")
        current_vehicle = self.request.get("vehicle")
        current_driver = self.request.get("driver")

        checkboxes = [
            general_checkbox, oil_checkbox, coolant_checkbox, belts_checkbox,
            battery_checkbox, engine_checkbox, gauges_checkbox,
            wipers_checkbox, horn_checkbox, heat_checkbox, mirrors_checkbox,
            steering_checkbox, brakes_checkbox, ebrake_checkbox,
            seatbelts_checkbox, safety_checkbox, lights_checkbox,
            reflectors_checkbox, suspension_checkbox, tires_checkbox,
            exhaust_checkbox, wheels_checkbox, exbrakes_checkbox
        ]
        action_items = []
        vehicle = Vehicle.get_by_id(int(current_vehicle))
        driver = Driver.get_by_id(int(current_driver))
        for i in checkboxes:
            if i != "":
                action_items.append(i)
        #if action_items != []:
        #vehicle.maintreq = True
        #vehicle.put()
        #else:
        #form = Inspection(formnum = form_num, items = "No maintenance required",
        #vehicle = vehicle)
        #form.put()

        t = jinja_env.get_template("inspectdetails.html")
        response = t.render(action_items=action_items,
                            form_num=form_num,
                            vehicle=vehicle,
                            driver=driver)
        self.write(response)
示例#3
0
    def post(self):
        driver = int(self.request.get("delete"))
        delete_driver = Driver.get_by_id(driver)

        delete_driver.delete()

        t = jinja_env.get_template("delete-confirm.html")
        content = t.render(driver=delete_driver)
        self.write(content)
示例#4
0
    def post(self):
        driver = int(self.request.get("driver"))
        edit_driver = Driver.get_by_id(driver)
        name = self.request.get("name")
        employeeid = int(self.request.get("employeeid"))

        edit_driver.name = name
        edit_driver.employeeid = employeeid
        edit_driver.put()

        self.redirect('/drivers')
示例#5
0
    def get(self):
        current_vehicle = self.request.get("vehicle")
        current_driver = self.request.get("driver")
        vehicle = Vehicle.get_by_id(int(current_vehicle))
        driver = Driver.get_by_id(int(current_driver))
        drivetype = type(current_driver)

        month = str(datetime.today().month)
        year = str(datetime.today().year)
        rand_num = str(random.randint(100, 999))
        today = rand_num + month + year

        t = jinja_env.get_template("inspectdetails.html")
        response = t.render(type=drivetype,
                            driver=driver,
                            vehicle=vehicle,
                            date=datetime.now(),
                            formid=today)
        self.write(response)