Exemplo n.º 1
0
	def post(self, id):
		date_accomplished = self.request.get("date")
		entry = Entry.get_by_key_name(id)
		entry.accomplished_on = date_accomplished
		entry.is_accomplished = True
		db.put(entry)
		self.render('single_entry_page.html', entry=entry, id=id)
Exemplo n.º 2
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!!')
Exemplo n.º 3
0
	def get(self, id):
		if self.user_is_authorized():
			# Find the entry with the specific id and render it on a page alone.
			entry = Entry.get_by_key_name(id)
			if entry:
				self.render('single_entry_page.html', entry=entry, id=id)