示例#1
0
    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))
示例#2
0
 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))
示例#3
0
    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))
示例#4
0
 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))
示例#5
0
    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))