コード例 #1
0
	def get(self):
		if not isUserLoggedIn(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		orderKey = self.request.get('orderKey')
		if orderKey != None:
			order = WebshopOrderItem.get(orderKey)
			order.addressString = order.address.zipNumCode + " " + order.address.street + " " + order.address.streetNumber
			order.price = order.item.price * order.orderQuantity
			if order != None:
				formattedComments = []
				for i in range(0,len(order.comments)):
					formattedComments.append(
						{
							"comment":order.comments[i],
							"author":order.commentAuthors[i],
							"date":order.commentDates[i]
						}
					)
				order.formattedComments = formattedComments
				template_values = {
					'order':order
				}
				template = jinja_environment.get_template('templates/webshop/userOrderDetails.html')
				self.printPage("Rendelés részletei", template.render(template_values), True, True)
				return
		self.printPage("Rendelés részletei", "Missing parameter for user order", True, True)
コード例 #2
0
	def post(self):
		if not isUserLoggedIn(self):
			self.session[LOGIN_NEXT_PAGE_KEY] = self.URL
			self.redirect("/")
			return
		orderKey = self.request.get('orderKey')
		order = WebshopOrderItem.get(orderKey)
		comments = order.comments
		comments.append(self.request.get('message'))
		order.comments = comments
		authors = order.commentAuthors
		authors.append('Én')
		order.commentAuthors = authors
		dates = order.commentDates
		dates.append(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
		order.commentDates = dates
		order.put()
		self.redirect("/webshopUserOrder?orderKey=" + orderKey)