コード例 #1
0
ファイル: room.py プロジェクト: TomFarrow/tournatrack
	def post(self):
		user = tusers.get_current_user()
		
		#Get the requested tournament
		tid = self.request.get('t')
		t_key = ndb.Key('Tournament', int(tid))
		t = t_key.get()
				
		if (user and user.key in t.owner):
			#Create a new Room object whose parent is the tournament
			room = Room(parent=t_key)
			room.name = self.request.get('room_name')
			room.active = True
			room.put()
			
			#Return the new room
			template_values = {
				'room' : room,
			}
			template = JINJA_ENVIRONMENT.get_template('view/json/room.json')
			self.response.write(template.render(template_values))
			
		else:
			self.redirect(tusers.create_login_url(self.request.uri))