本文整理汇总了Python中models.Room.get方法的典型用法代码示例。如果您正苦于以下问题:Python Room.get方法的具体用法?Python Room.get怎么用?Python Room.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Room
的用法示例。
在下文中一共展示了Room.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Room [as 别名]
# 或者: from models.Room import get [as 别名]
def get(self):
room_key = self.request.get('room_key')
room = Room.get(room_key)
data_list = []
#data_list = room.getRoomProfile()
data_list.append({'roomNumber':room.roomNumber,'area':room.area,'rentSingle':room.rentSingle,'rentDouble':room.rentDouble})
output_json = json.dumps(data_list)
self.response.out.write(output_json)
示例2: rooms_edit
# 需要导入模块: from models import Room [as 别名]
# 或者: from models.Room import get [as 别名]
def rooms_edit(request):
id = int(request.GET.get('id'))
room = Room.get(db.Key.from_path('Room', id))
if request.method != 'POST':
form = RoomForm(instance=room)
return respond(request, 'room_edit.html', {'form': form, 'id': id })
form = RoomForm(request.POST,instance=room)
if form.is_valid():
entity = form.save()
entity.put()
return HttpResponseRedirect(reverse(rooms))
else:
return respond(request, 'room_edit.html', {'form': form })
示例3: rooms_delete
# 需要导入模块: from models import Room [as 别名]
# 或者: from models.Room import get [as 别名]
def rooms_delete(request):
id = int(request.GET.get('id'))
room = Room.get(db.Key.from_path('Room', id))
room.active = False
room.put()
return HttpResponseRedirect(reverse(rooms))