Ejemplo n.º 1
0
	def get(self):
		user = tusers.get_current_user()
		
		if user:
			
			#Get a list of tournaments that the user owns
			owner_q = Tournament.query(Tournament.owner == user.key)

			#Get a list of tournaments that the user is attending
			attend_q = Attending.query(ancestor=user.key)


			#Build a list of tournaments to pass to the view
			tournaments = []
			for a in attend_q:
				tournament = tournament_bean()
				tournament.tournament = a.tournament.get()
				tournament.role = a.role
				tournaments.append(tournament)


			template_values = {
				'user' : user,
				'tournaments' : owner_q,
				'attending' : tournaments,
				'logout' : tusers.create_logout_url('/'),
			}
			template = JINJA_ENVIRONMENT.get_template('view/tournaments.html')
			self.response.write(template.render(template_values))
		else:
			self.redirect(tusers.create_login_url(self.request.uri))
Ejemplo n.º 2
0
	def get(self):
		user = tusers.get_current_user()

		if user:

			#Get a list of tournaments that the user owns
			owner_q = Tournament.query(Tournament.owner == user.key)

			#Tournaments that the user has registered for
			reg_q = RegisteredEntity.query(RegisteredEntity.user == user.key)
			attending = reg_q.map(tournament_for_registration)
			logging.info(attending)

			template_values = {
				'user' : user,
				'tournaments' : owner_q,
				'logout' : tusers.create_logout_url('/'),
				'attending' : attending
			}
			template = JINJA_ENVIRONMENT.get_template('view/tournaments.html')
			self.response.write(template.render(template_values))
		else:
			self.redirect(tusers.create_login_url(self.request.uri))
Ejemplo n.º 3
0
 def get(self):
     set_json_response(self.response, [tournament.get_data() for tournament in Tournament.query()])