示例#1
0
	def get(self):
		user = users.get_current_user()
		if user:
			helpers.checkUser(user)
			adminAcc = Admin.get_by_id(user.user_id())
			if adminAcc:
				template = jinja_environment.get_template('templates/admin_settings.html')
				template_values = getTemplateValues(adminAcc, self)
				self.response.write(template.render(template_values))
		else:
			self.redirect('/')
示例#2
0
	def get(self, page):
		user = users.get_current_user()
		if user:
			helpers.checkUser(user)
			adminAcc = entities.Admin.get_by_id(user.user_id())
			if adminAcc:
				template_values = adminFunctions.getTemplateValues(adminAcc, page)
				template = jinja_environment.get_template('templates/edit_sessions.html')
			else:
				acc = entities.Account.get_by_id(user.user_id())
				test = userFunctions.SignUpHandler()
				template_values = userFunctions.getTemplateValues(acc, page)
				template = jinja_environment.get_template('templates/logged_in.html')

			page.response.write(template.render(template_values))
		else:
			self.redirect('/')
示例#3
0
	def get(self):
		user = users.get_current_user()
		helpers.checkUser(user)
		acc = Account.get_by_id(user.user_id())
		q_string = self.request.query_string
		q_list = q_string.split('&')
		if len(q_list) > 1:
			pass #error
		else:
			slot_key = ndb.Key(urlsafe=q_list[0])
			slot = slot_key.get()
			if slot:
				for registrant_key in slot.registrants:
					registrant = registrant_key.get()
					registrant.slots.remove(slot_key)
					registrant.put()
				slot_key.delete()
			else:
				pass #error
		self.redirect('/admin_sessions')
示例#4
0
	def get(self):
		user = users.get_current_user()
		helpers.checkUser(user)
		acc = entities.Account.get_by_id(user.user_id())
		q_string = self.request.query_string
		q_list = q_string.split('&')
		if len(q_list) > 1:
			pass #error
		else:
			slot_key = ndb.Key(urlsafe=q_list[0])
			slot = slot_key.get()
			if slot:
				if acc.key in slot.registrants:
					slot.registrants.remove(acc.key)
					slot.put()
				if slot.key in acc.slots:
					acc.slots.remove(slot_key)
					acc.put()
			else:
				pass #error
		self.redirect('/')
示例#5
0
	def get(self):
		user = users.get_current_user()
		if user:
			helpers.checkUser(user)
			acc = entities.Account.get_by_id(user.user_id())
			template = jinja_environment.get_template('templates/logged_in.html')
			template_values = {
				'userAcc': acc,
				'slots': helpers.getUpcomingSlots(),
				'now': datetime.datetime.now(),
				'logInOut': users.create_logout_url(self.request.uri),
				'logInOut_linkText': 'Logout',
				'userName': acc.name,
				'userMatric': acc.matric,
				'userMobile': acc.mobile,
				'registeredSlots': acc.slots,
				'loggedIn': True,
				'signupError': True
			}
			self.response.write(template.render(template_values))
		else:
			self.redirect('/')
示例#6
0
	def get(self):
		user = users.get_current_user()
		helpers.checkUser(user)
		acc = entities.Account.get_by_id(user.user_id())
		if acc.name == defaults.name or acc.matric == defaults.matric or acc.mobile == defaults.mobile:
			self.redirect('/signup_error')
		else:
			q_string = self.request.query_string
			q_list = q_string.split('&')
			if len(q_list) > 1:
				pass #error
			else:
				slot_key = ndb.Key(urlsafe=q_list[0])
				slot = slot_key.get()
				if slot:
					if acc.key not in slot.registrants:
						slot.registrants.append(acc.key)
						slot.put()
					if slot.key not in acc.slots:
						acc.slots.append(slot_key)
						acc.put()
				else:
					pass #error
			self.redirect('/')