本文整理匯總了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))