def post(self): catalog_name = self.request.get('catalog_name', DEFAULT_CATALOG_NAME) category = Category(parent=catalog_key(catalog_name)) category.name = self.request.get('name') category_service = CategoryService() category_service.add_category(category) query_params = {'catalog_name': catalog_name} self.redirect('/categories?' + urllib.urlencode(query_params))
def get(self): self.response.headers["Content-Type"] = "text/html" cat = self.request.get("catalog_name", DEFAULT_CATALOG_NAME) category_service = CategoryService() categories = category_service.get_categories(cat) template_values = {"categories": categories, "catalog_name": urllib.quote_plus(cat)} template = JINJA_ENVIRONMENT.get_template("categories.html") # Write the submission form and the footer of the page sign_query_params = urllib.urlencode({"catalog_name": cat}) self.response.write(template.render(template_values))
def post(self): catalog_name = self.request.get("catalog_name", DEFAULT_CATALOG_NAME) category = Category(parent=catalog_key(catalog_name)) category.name = self.request.get("name") category_service = CategoryService() category_service.add_category(category) query_params = {"catalog_name": catalog_name} self.redirect("/categories?" + urllib.urlencode(query_params))
def get(self): self.response.headers['Content-Type'] = 'text/html' cat = self.request.get('catalog_name', DEFAULT_CATALOG_NAME) category_service = CategoryService() categories = category_service.get_categories(cat) template_values = { 'categories': categories, 'catalog_name': urllib.quote_plus(cat) } template = JINJA_ENVIRONMENT.get_template('categories.html') # Write the submission form and the footer of the page sign_query_params = urllib.urlencode({'catalog_name': cat}) self.response.write(template.render(template_values))
def get(self): self.response.headers['Content-Type'] = 'text/html' catalog_name = self.request.get('catalog_name', DEFAULT_CATALOG_NAME) restaurant_service = RestaurantService() restaurants = restaurant_service.get_restaurants(catalog_name) category_service = CategoryService() categories_html = web.views.category.get_category_dropdown( category_service.get_categories('categories'), selected=catalog_name, select_attrs='name=catalog_name') template_values = { 'restaurants': restaurants, 'catalog_name': urllib.quote_plus(catalog_name), 'categories': categories_html } template = JINJA_ENVIRONMENT.get_template('browse.html') # Write the submission form and the footer of the page sign_query_params = urllib.urlencode({'catalog_name': catalog_name}) self.response.write(template.render(template_values))