def addSensor(len, index, addr, type, storage): for i in range(len): a=Sensor() a.sensor_index=index[i] a.storage=storage a.type=type a.location=addr[i] a.save()