Example #1
0
	def get(self):
		if not isUserCook(self):
			self.redirect("/")
			return	
		ingredientKey=self.request.get('ingredientKey')
		sourceKey=self.request.get('source')
		if ((ingredientKey != None) and (ingredientKey != "")):
			ingredient = getIngredient(ingredientKey)
			availableCategories = getIngredientCategories()
			template_values = {
				'ingredient': ingredient,
				'availableCategories':availableCategories,
				'source':sourceKey
			}
			template = jinja_environment.get_template('templates/ingredient.html')
			self.printPage(ingredient['name'], template.render(template_values), False, False)
		else:
			template_values = {
				'ingredients': getIngredients(),
				'delete_url':"/deleteIngredient"
			}
			template = jinja_environment.get_template('templates/ingredient_list.html')
			self.printPage("Alapanyagok", template.render(template_values), False, False)
	def get(self):
		if not isUserCook(self):
			self.redirect("/")
			return
		ingredientCategoryKey = self.request.get('ingredientCategoryKey') 
		if ingredientCategoryKey!= None and ingredientCategoryKey != "":
		# List every ingredient in the category
			ingredientCategory = getIngredientCategoryWithIngredients(ingredientCategoryKey)
			template_values = {
				'ingredientCategory': ingredientCategory,
				'add_url':"/addIngredientToCategory",
				'delete_url':"/deleteIngredientFromCategory"
			}
			template = jinja_environment.get_template('templates/ingredient_category.html')
			self.printPage(ingredientCategory['name'], template.render(template_values), False, False)
		else:
		# All categories
			ingredientCategories = getIngredientCategories()
			template_values = {
				'ingredientCategories': ingredientCategories,
				'delete_url':"/deleteIngredientCategory"
			}
			template = jinja_environment.get_template('templates/ingredient_category_list.html')
			self.printPage("Alapanyag kategoriak", template.render(template_values), False, False)