示例#1
0
    def get(self):
        vehicle = int(self.request.get("edit"))
        edit_vehicle = Vehicle.get_by_id(vehicle)

        t = jinja_env.get_template("vehicleedit.html")
        content = t.render(vehicle=edit_vehicle)
        self.write(content)
示例#2
0
    def post(self):
        maint_vehicle = self.request.get("maint_vehicle")
        vehicle = Vehicle.get_by_id(int(maint_vehicle))

        vehicle.maintreq = False
        vehicle.put()

        self.redirect("/maintenance")
示例#3
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)
示例#4
0
    def post(self):
        vehicle = int(self.request.get("delete"))
        delete_vehicle = Vehicle.get_by_id(vehicle)

        delete_vehicle.delete()

        t = jinja_env.get_template("delete-confirm.html")
        content = t.render(vehicle=delete_vehicle)
        self.write(content)
示例#5
0
    def post(self):
        vehicle_id = self.request.get("vehicle")
        vehicle = Vehicle.get_by_id(int(vehicle_id))

        vehicle.maintreq = True
        vehicle.put()

        t = jinja_env.get_template("request-confirmation.html")
        response = t.render(vehicle=vehicle)
        self.write(response)
示例#6
0
    def get(self, id):

        vehicle = Vehicle.get_by_id(int(id))
        if vehicle:
            t = jinja_env.get_template("vehicle.html")
            response = t.render(vehicle=vehicle)
        else:
            error = "there is no post with id %s" % id
            t = jinja_env.get_template("404.html")
            response = t.render(error=error)
示例#7
0
    def post(self):
        current_vehicle = self.request.get("vehicle")
        chosen_type = self.request.get("type")
        description = self.request.get("description")
        chosen_vehicle = Vehicle.get_by_id(int(current_vehicle))

        maint = MaintRecord(typeofmaint=chosen_type,
                            description=description,
                            vehicle=chosen_vehicle)
        maint.put()
        chosen_vehicle.lastservic = datetime.today()
        chosen_vehicle.put()

        self.redirect('/records')
示例#8
0
    def post(self):
        vehicle = int(self.request.get("vehicle"))
        edit_vehicle = Vehicle.get_by_id(vehicle)
        make = self.request.get("make")
        model = self.request.get("model")
        year = int(self.request.get("year"))
        odometer = int(self.request.get("odometer"))
        vin = self.request.get("vin")

        edit_vehicle.make = make
        edit_vehicle.model = model
        edit_vehicle.year = year
        edit_vehicle.odometer = odometer
        edit_vehicle.vin = vin
        edit_vehicle.put()

        self.redirect('/fleet')
示例#9
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)
示例#10
0
    def post(self):
        formnum = self.request.get("form")
        details = self.request.get("details")
        items = self.request.POST.getall("items")
        current_vehicle = self.request.get("vehicle")
        vehicle = Vehicle.get_by_id(int(current_vehicle))
        current_driver = self.request.get("driver")
        #driver = Driver.get_by_id(int(current_driver))

        item = []
        for x in items:
            x = str(x)
            item.append(x)

        drivertype = type(current_driver)

        #form = InspectForm(formnum=str(formnum),items=item,details=str(details),vehicle=vehicle, driver=driver)
        #form.put()

        t = jinja_env.get_template("test.html")
        #response = t.render(forms=self.get_inspections())
        response = t.render(driver=current_driver, type=drivertype)
        self.write(response)
示例#11
0
 def get(self):
     maintvehicle = self.request.get("vehicle")
     t = jinja_env.get_template("maintneeded.html")
     response = t.render(vehicle=Vehicle.get_by_id(int(maintvehicle)))
     self.write(response)