Ejemplo n.º 1
0
 def new(self):
     "Add an organization"
     c.form = OrgForm(request.POST, csrf_context=session)
     c.form.domains.query = Session.query(Domain)
     c.form.admins.query = Session.query(User).filter(User.account_type == 2)
     if request.POST and c.form.validate():
         try:
             org = Group()
             org.name = c.form.name.data
             org.domains = c.form.domains.data
             Session.add(org)
             Session.commit()
             info = ADDORG_MSG % dict(o=org.name)
             audit_log(c.user.username, 3, info, request.host, request.remote_addr, now())
             flash(_("The organization has been created"))
             redirect(url(controller="organizations"))
         except IntegrityError:
             flash_alert(_("The organization already exists"))
     return render("/organizations/add.html")
Ejemplo n.º 2
0
 def new(self):
     "Add an organization"
     c.form = OrgForm(request.POST, csrf_context=session)
     c.form.domains.query = Session.query(Domain)
     c.form.admins.query = Session.query(User).filter(
         User.account_type == 2)
     if request.POST and c.form.validate():
         try:
             org = Group()
             org.name = c.form.name.data
             org.domains = c.form.domains.data
             Session.add(org)
             Session.commit()
             info = ADDORG_MSG % dict(o=org.name)
             audit_log(c.user.username, 3, info, request.host,
                       request.remote_addr, datetime.now())
             flash(_('The organization has been created'))
             redirect(url(controller='organizations'))
         except IntegrityError:
             flash_alert(_('The organization already exists'))
     return render('/organizations/add.html')