Exemplo n.º 1
0
    def post(self):
        form = ProjectCategoryForm(self.request.POST)

        if form.validate():
            title = form.data["title"]
            slug = title.lower().replace(" ", "-")
            category = ProjectCategory(title = title, slug = slug)
            category.put()

        self.redirect_to('admin-projects-categories')
Exemplo n.º 2
0
    def post(self, category_id):
        form = ProjectCategoryForm(self.request.POST)

        if form.validate():
            slug = form.data["title"].lower().replace(" ", "-")
            category = ProjectCategory.get(long(category_id))
            form.populate_obj(category)
            category.put()

        return {
            "result": {
               "id": category.key().id(),
               "title": category.title,
               "slug": category.slug,
           }
        }