Beispiel #1
0
 def GET(self):
     templates = get_templates()
     req = web.ctx.req
     req.update({
         'templates': templates,
         })
     return admin_render.template_index(**req)
Beispiel #2
0
 def GET(self):
     templates = get_templates()
     req = web.ctx.req
     req.update({
         'templates': templates,
     })
     return admin_render.template_index(**req)
Beispiel #3
0
 def GET(self):
     form = model_form()
     models = get_active_models()
     templates = get_templates()
     req = web.ctx.req
     req.update({
         'form': form,
         'templates': templates,
         'models': models,
         'fields': [],
         'relations': [],
         })
     return admin_render.model_edit(**req)
Beispiel #4
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)
Beispiel #5
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)
Beispiel #6
0
 def GET(self):
     form = model_form()
     models = get_active_models()
     templates = get_templates()
     req = web.ctx.req
     req.update({
         'form': form,
         'templates': templates,
         'models': models,
         'fields': [],
         'relations': [],
     })
     return admin_render.model_edit(**req)
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
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')
Beispiel #10
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')
Beispiel #11
0
 def POST(self):
     form = model_form()
     valid = form.validates()
     is_unique_name = get_model_by_name(form.name.get_value()) is None
     if not valid or not is_unique_name:
         if not is_unique_name:
             form.name.note = u"%s已存在,请重新指定。" % (form.name.get_value())
         templates = get_templates()
         models = get_active_models()
         req = web.ctx.req
         req.update({
             'form': form,
             'templates': templates,
             'models': models,
             'fields': [],
             'relations': [],
             })
         return admin_render.model_edit(**req)
     save_model(-1, form.d)
     raise web.seeother('/model/index')
Beispiel #12
0
 def POST(self):
     form = model_form()
     valid = form.validates()
     is_unique_name = get_model_by_name(form.name.get_value()) is None
     if not valid or not is_unique_name:
         if not is_unique_name:
             form.name.note = u"%s已存在,请重新指定。" % (form.name.get_value())
         templates = get_templates()
         models = get_active_models()
         req = web.ctx.req
         req.update({
             'form': form,
             'templates': templates,
             'models': models,
             'fields': [],
             'relations': [],
         })
         return admin_render.model_edit(**req)
     save_model(-1, form.d)
     raise web.seeother('/model/index')
Beispiel #13
0
 def GET(self, id):
     model = get_model(id)
     if model.is_active:
         raise web.seeother('/model/%s/view' % id)
     templates = get_templates()
     models = get_active_models()
     form = model_form()
     fields = get_fields(id)
     relations = get_relations(id)
     form.fill(model)
     req = web.ctx.req
     req.update({
         'mid': id,
         'form': form,
         'templates': templates,
         'models': models,
         'fields': fields,
         'relations': relations,
         '_typetext': typetext,
         })
     return admin_render.model_edit(**req)
Beispiel #14
0
 def GET(self, id):
     model = get_model(id)
     if model.is_active:
         raise web.seeother('/model/%s/view' % id)
     templates = get_templates()
     models = get_active_models()
     form = model_form()
     fields = get_fields(id)
     relations = get_relations(id)
     form.fill(model)
     req = web.ctx.req
     req.update({
         'mid': id,
         'form': form,
         'templates': templates,
         'models': models,
         'fields': fields,
         'relations': relations,
         '_typetext': typetext,
     })
     return admin_render.model_edit(**req)
Beispiel #15
0
 def POST(self, id):
     form = model_form()
     valid = form.validates()
     is_unique_name = not get_other_models(int(id), form.name.get_value())
     if not valid or not is_unique_name:
         if not is_unique_name:
             form.name.note = u"%s已存在,请重新指定。" % (form.name.get_value())
         templates = get_templates()
         models = get_active_models()
         fields = get_fields(id)
         relations = get_relations(id)
         req = web.ctx.req
         req.update({
             'mid': id,
             'form': form,
             'templates': templates,
             'models': models,
             'fields': fields,
             'relations': relations,
             })
         return admin_render.model_edit(**req)
     save_model(int(id), form.d)
     raise web.seeother('/model/index')
Beispiel #16
0
 def POST(self, id):
     form = model_form()
     valid = form.validates()
     is_unique_name = not get_other_models(int(id), form.name.get_value())
     if not valid or not is_unique_name:
         if not is_unique_name:
             form.name.note = u"%s已存在,请重新指定。" % (form.name.get_value())
         templates = get_templates()
         models = get_active_models()
         fields = get_fields(id)
         relations = get_relations(id)
         req = web.ctx.req
         req.update({
             'mid': id,
             'form': form,
             'templates': templates,
             'models': models,
             'fields': fields,
             'relations': relations,
         })
         return admin_render.model_edit(**req)
     save_model(int(id), form.d)
     raise web.seeother('/model/index')