예제 #1
0
    def post(self):
        tpls = [(t.tpl_name, t.tpl_desc) for t in self.db.query(models.TrwTemplate)]
        isps = [(t.isp_code, t.isp_name) for t in self.db.query(models.TrwIsp)]
        form = domain_form.domain_add_vform(tpls=tpls, isps=isps)
        if not form.validates(source=self.get_params()):
            return self.render("base_form.html", form=form)
        if self.db.query(models.TrwDomain.id).filter_by(
            domain_code=form.d.domain_code,
            isp_code=form.d.isp_code).count() > 0:
            return self.render("base_form.html", form=form, msg=u"domain已经存在")
        domain = models.TrwDomain()
        domain.tpl_name = form.d.tpl_name
        domain.isp_code = form.d.isp_code
        domain.domain_code = form.d.domain_code
        domain.domain_desc = form.d.domain_desc
        self.db.add(domain)

        self.add_oplog(u'新增域信息:%s' % (form.d.domain_code))
        self.db.commit()
        self.redirect("/domain",permanent=False)
예제 #2
0
파일: domain.py 프로젝트: lanyeit/toughwlan
    def post(self):
        tpls = [(t.tpl_name, t.tpl_desc) for t in self.db.query(models.TrwTemplate)]
        form = domain_form.domain_add_vform(tpls=tpls)
        if not form.validates(source=self.get_params()):
            return self.render("base_form.html", form=form)
        if self.db.query(models.TrwDomain.id).filter_by(domain_code=form.d.domain_code).count() > 0:
            return self.render("base_form.html", form=form, msg=u"domain已经存在")
        domain = models.TrwDomain()
        domain.tpl_name = form.d.tpl_name
        domain.domain_code = form.d.domain_code
        domain.domain_desc = form.d.domain_desc
        self.db.add(domain)

        ops_log = models.TrwOperateLog()
        ops_log.operator_name = self.current_user.username
        ops_log.operate_ip = self.current_user.ipaddr
        ops_log.operate_time = utils.get_currtime()
        ops_log.operate_desc = u'操作员(%s)新增域信息:%s' % (ops_log.operator_name, form.d.domain_code)
        self.db.add(ops_log)

        self.db.commit()
        self.redirect("/domain",permanent=False)
예제 #3
0
 def get(self):
     tpls = [(t.tpl_name, t.tpl_desc) for t in self.db.query(models.TrwTemplate)]
     isps = [(t.isp_code, t.isp_name) for t in self.db.query(models.TrwIsp)]
     self.render("base_form.html", form=domain_form.domain_add_vform(tpls=tpls,isps=isps))