Example #1
0
def updateVehicleType(id, description):
    global action
    global response
    
    vehicleTypeSelected = services.findVehicleTypeById(current_user.parking.identificationCode, id)
    
    form = VehicleTypeForm(request.form, description=vehicleTypeSelected.description)
    if form.validate_on_submit():
        action = 'update'
        response = services.updateVehicleType(current_user.parking.identificationCode, id, form.description.data)
        return redirect(url_for('.getAllVehicle'))
    
    vehicleTypeList = services.getAllVehicleType(current_user.parking.identificationCode)
    rt = render_template('abm-vehicle.html', form=form, vehicleTypeList=vehicleTypeList, action=action, response=response)
    
    return rt
Example #2
0
def getAllVehicle():
    global action
    global response
    
    form = VehicleTypeForm(request.form)
    if form.validate_on_submit():
        action = 'save'
        response = services.saveVehicleType(current_user.parking.identificationCode, form.description.data)
        cleanFields(response, form)
    vehicleTypeList = services.getAllVehicleType(current_user.parking.identificationCode)
    rt = render_template('abm-vehicle.html', form=form, vehicleTypeList=vehicleTypeList, action=action, response=response)
    
    action = None
    response = None
    
    return rt
Example #3
0
    def loadVehicleTypeValues(self):
        self.vehicle.choices = [("999", "Seleccione")]

        for vehicleTypeValue in services.getAllVehicleType(current_user.parking.identificationCode).vehicles:
            self.vehicle.choices.append(( str(vehicleTypeValue.id).decode('base64'), vehicleTypeValue.description))