Exemple #1
0
    def post(self):
        form = bas_forms.bas_add_form()
        if not form.validates(source=self.get_params()):
            return self.render("base_form.html", form=form)

        if self.db.query(models.TrBas.id).filter_by(ip_addr=form.d.ip_addr).count() > 0:
            return self.render("base_form.html", form=form, msg=u"接入设备地址已经存在")

        bas = models.TrBas()
        bas.ip_addr = form.d.ip_addr
        bas.bas_name = form.d.bas_name
        bas.time_type = form.d.time_type
        bas.vendor_id = form.d.vendor_id
        bas.bas_secret = form.d.bas_secret
        bas.coa_port = form.d.coa_port
        self.db.add(bas)

        self.add_oplog(u'新增接入设备信息:%s' % bas.ip_addr)

        self.db.commit()
        self.redirect("/admin/bas",permanent=False)
Exemple #2
0
 def get(self):
     form = bas_forms.bas_add_form()
     self.render("base_form.html", form=form)