Example #1
0
	def post(self):
		if self.user_is_authorized():
		
			# Should receive title and entry (description) as headers in POST
  			title = self.request.get("title")
			description = self.request.get("description")
			location = self.request.get("location")
		
			# If they are valid, create a unique ID for the post, save it to the database,
			# and load the entry alone on a formatted page
			if title and description and location:
				id = str(uuid.uuid1())
				new_entry = Entry(key_name=id, title=title, description=description, location=location)
				new_entry.put()
			
				self.redirect("/todo/" + id)
		
			# Otherwise, return to page and report an error to the user
			else:
				self.render('new_entry.html',error='Please fill in all fields!!')