Esempio n. 1
0
	def get(self, slug):
		people = []

		q = Location.gql("WHERE slug = :slug", slug = slug)

		location = q.get()
		if location:
			tapins = Tapin.gql("WHERE location = :location ORDER BY date", location = location)

			from collections import defaultdict
			grouped = defaultdict(list)
			for tapin in tapins: 
				grouped[tapin.date.date()].append(tapin)

			tapin = self.request.get('tapin')

			template = jinja_environment.get_template("location.html")
			self.response.out.write(template.render({
				"user": users.get_current_user(),
				"location": location,
				"tapins": grouped,
				"tapin": tapin
			}))
		else:
			self.redirect("/new-location?slug=%s&message=not-found" % slug)
Esempio n. 2
0
	def get(self):
		user = users.get_current_user()
		if user:
			tapins = Tapin.gql("WHERE user = :user ORDER BY date DESC", user = user)
			locations = []
			for loc in filter(None, map(lambda x: x.geolocation, tapins)):
				locations.append([loc.lat, loc.lon])
			pointjson = json.dumps(locations)

			template = jinja_environment.get_template("user.html")
			self.response.out.write(template.render({"user": user, "tapins": tapins, "pointjson": pointjson}))
		else:
			self.redirect(users.create_login_url("/"))
Esempio n. 3
0
	def get(self):
		tapins = Tapin.gql("ORDER BY date")
		template = jinja_environment.get_template("tapins.html")
		self.response.out.write(template.render({"tapins":tapins}))