예제 #1
0
 def GET(self, id):
     form = category_form()
     category = get_category(id)
     categories = category_tree()
     templates = get_templates()
     form.fill(category)
     req = web.ctx.req
     req.update({
         'form': form,
         'categories': categories,
         'templates': templates,
         })
     return admin_render.category_edit(**req)
예제 #2
0
 def GET(self):
     form = category_form()
     categories = category_tree()
     templates = get_templates()
     parent_id = web.input(parent_id=None).parent_id
     form.parent_id.set_value(parent_id)
     req = web.ctx.req
     req.update({
         'form': form,
         'categories': categories,
         'templates': templates,
         })
     return admin_render.category_edit(**req)
예제 #3
0
 def GET(self, id):
     form = category_form()
     category = get_category(id)
     categories = category_tree()
     templates = get_templates()
     form.fill(category)
     req = web.ctx.req
     req.update({
         'form': form,
         'categories': categories,
         'templates': templates,
     })
     return admin_render.category_edit(**req)
예제 #4
0
 def GET(self):
     form = category_form()
     categories = category_tree()
     templates = get_templates()
     parent_id = web.input(parent_id=None).parent_id
     form.parent_id.set_value(parent_id)
     req = web.ctx.req
     req.update({
         'form': form,
         'categories': categories,
         'templates': templates,
     })
     return admin_render.category_edit(**req)
예제 #5
0
 def POST(self):
     form = category_form()
     valid = form.validates()
     is_unique_slug = get_category_by_slug(form.d.slug) is None
     if not valid or not is_unique_slug:
         if not is_unique_slug:
             form.slug.note = u"%s已存在,请重新指定。" % (form.d.slug)
         categories = category_tree()
         templates = get_templates()
         req = web.ctx.req
         req.update({
             'form': form,
             'categories': categories,
             'templates': templates,
             })
         return admin_render.category_edit(**req)
     new_category(form.d)
     raise web.seeother('/category/index')
예제 #6
0
 def POST(self):
     form = category_form()
     valid = form.validates()
     is_unique_slug = get_category_by_slug(form.d.slug) is None
     if not valid or not is_unique_slug:
         if not is_unique_slug:
             form.slug.note = u"%s已存在,请重新指定。" % (form.d.slug)
         categories = category_tree()
         templates = get_templates()
         req = web.ctx.req
         req.update({
             'form': form,
             'categories': categories,
             'templates': templates,
         })
         return admin_render.category_edit(**req)
     new_category(form.d)
     raise web.seeother('/category/index')