本文整理汇总了Python中device.Device.all方法的典型用法代码示例。如果您正苦于以下问题:Python Device.all方法的具体用法?Python Device.all怎么用?Python Device.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类device.Device
的用法示例。
在下文中一共展示了Device.all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import all [as 别名]
def post(self):
devName = self.request.get("deviceName")
device_query = Device.all().filter("name = ", devName)
devItem = device_query.fetch(1)[0]
fwgName = self.request.get("fwgName")
fw_query = FirmwareGroup.all().filter("name = ", fwgName)
fwgItem = fw_query.fetch(1)[0]
releaseNumber = self.request.get("releaseName")
relQuery = Firmware.all().filter("group = ", fwgItem).filter("version = ", releaseNumber)
relItem = relQuery.fetch(1)[0]
installationTime = self.request.get("releaseDate")
if installationTime.strip().lower() == "now":
installationTime = None
else:
installationTime = datetime.strptime(installationTime, "%Y-%m-%d")
gUser = users.get_current_user()
query = User.all().filter("googleUser = ", gUser)
res = query.fetch(1)
myUser = res[0]
udu = UserDeviceUpdates()
udu.user = myUser
udu.device = devItem
udu.release = relItem
if installationTime:
udu.updateDatetime = installationTime
udu.put()
示例2: get
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import all [as 别名]
def get(self):
devName = self.request.get("devName")
device_query = Device.all().filter("name = ", devName)
devItem = device_query.fetch(1)[0]
gUser = users.get_current_user()
query = User.all().filter("googleUser = ", gUser)
res = query.fetch(1)
myUser = res[0]
query = UserDeviceUpdates.all().filter("user = ", myUser).filter("device = ", devItem).order("-updateDatetime")
releases = query.fetch(20)
txt = ""
for release in releases:
txt += "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n" % (
str(release.updateDatetime.date()),
release.release.group.name,
release.release.version,
)
self.response.out.write(txt)