Beispiel #1
0
    def post(self, *args, **kwargs):
        form = domain_form.domain_attr_update_form()
        if not form.validates(source=self.get_params()):
            return self.render("base_form,html", form=form)

        domain_attr = self.db.query(models.TrwDomainAttr).get(form.d.id)
        domain_attr.attr_name = form.d.attr_name
        domain_attr.attr_value = form.d.attr_value
        domain_attr.attr_desc = form.d.attr_desc

        self.db.commit()
        domain_id = self.db.query(models.TrwDomain.id).filter_by(
            domain_code=form.d.domain_code,isp_code=form.d.isp_code).scalar()
        self.redirect("/domain/detail?domain_id=%s" % domain_id)
Beispiel #2
0
 def get(self):
     attr_id = self.get_argument("attr_id")
     attr = self.db.query(models.TrwDomainAttr).get(attr_id)
     form = domain_form.domain_attr_update_form()
     form.fill(attr)
     self.render("base_form.html", form=form)