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')
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, } }