Exemplo n.º 1
0
 def update(self, id):
     record = meta.Session.query(model.Record).filter_by(id=id, domain_id=c.domain.id).first()
     c.fs = RecordFields.bind(record, data=request.POST)
     if c.fs.validate():
         c.fs.sync()
         meta.Session.commit()
         h.flash('Record updated.')
         return redirect(url('domain', id=c.domain.id))
     else:
         return render('records/edit.html')
Exemplo n.º 2
0
 def update(self, id):
     domain = meta.Session.query(model.Domain).filter_by(id=id).first()
     c.fs = DomainFields.bind(domain, data=request.POST)
     if c.fs.validate():
         c.fs.sync()
         meta.Session.commit()
         h.flash('Domain updated.')
         return redirect(url('domains'))
     else:
         return render('domains/edit.html')
Exemplo n.º 3
0
 def update(self, id):
     user = meta.Session.query(model.User).filter_by(id=id).first()
     c.fs = UserFields.bind(user, data=request.POST)
     c.fs.password.validators.remove(formalchemy.validators.required)
     if c.fs.validate():
         c.fs.sync()
         meta.Session.commit()
         h.flash('User updated.')
         return redirect(url('users'))
     else:
         return render('users/edit.html')
Exemplo n.º 4
0
 def create(self):
     domain = model.Domain()
     c.fs = DomainFields.bind(domain, data=request.POST)
     if c.fs.validate():
         c.fs.sync()
         meta.Session.add(domain)
         meta.Session.commit()
         h.flash('Domain created.')
         return redirect(url('domains'))
     else:
         return render('domains/new.html')
Exemplo n.º 5
0
 def create(self):
     user = model.User()
     c.fs = UserFields.bind(user, data=request.POST)
     if c.fs.validate():
         c.fs.sync()
         meta.Session.add(user)
         meta.Session.commit()
         h.flash('User created.')
         return redirect(url('users'))
     else:
         return render('users/new.html')
Exemplo n.º 6
0
 def create(self):
     record = model.Record()
     c.fs = RecordFields.bind(record, data=request.POST)
     if c.fs.validate():
         c.fs.sync()
         record.domain_id = c.domain.id
         meta.Session.add(record)
         meta.Session.commit()
         h.flash('Record created.')
         return redirect(url('domain', id=c.domain.id))
     else:
         return render('records/new.html')
Exemplo n.º 7
0
 def sign_up_submit(self):
     user = model.User()
     c.fs = UserFields.bind(user, data=request.POST)
     if c.fs.validate():
         c.fs.sync()
         meta.Session.add(user)
         meta.Session.commit()
         meta.Session.commit()
         h.flash('You have successfully signed up.')
         redirect('/')
     else:
         return render('/auth/sign_up.html')
Exemplo n.º 8
0
 def index(self):
     query = meta.Session.query(Event)
     
     if 'action' in request.params and request.params['action']:
       query = query.filter_by(action=request.params['action'])
     if 'user' in request.params and request.params['user']:
       query = query.filter_by(user_id=request.params['user'])
     if 'date_from' in request.params and request.params['date_from']:
       query = query.filter(Event.created_at >= request.params['date_from'])
     if 'date_to' in request.params and request.params['date_to']:
       query = query.filter(Event.created_at <= request.params['date_to'])
       
     c.events = query.order_by('created_at desc').all()
     c.users = meta.Session.query(User).all()
     return render('events/index.html')
Exemplo n.º 9
0
 def sign_in_submit(self):
     c.fs = UserFields.bind(model.User, data=request.POST)
     user = meta.Session.query(model.User).filter_by(username=c.fs.username.value).first()
     if (user and user.authenticate(c.fs.password.value)):
         if user.is_active == True:
             session["user"] = user
             session.save()
             h.flash('Logged in successfully.')
             if 'path_before_login' in session:
                 redirect(session['path_before_login'])
         else:
             h.flash('Please wait before your account will be activated.')
         redirect('/')
     else:
         h.flash('Username or password doesn\'t match.')
         return render('/auth/sign_in.html')
Exemplo n.º 10
0
 def edit(self, id, format='html'):
     c.domain = meta.Session.query(model.Domain).filter_by(id=id).first()
     c.fs = DomainFields.bind(c.domain)
     return render('domains/edit.html')
Exemplo n.º 11
0
 def show(self, id):
     c.domain = meta.Session.query(model.Domain).filter_by(id=id).first()
     return render('domains/show.html')
Exemplo n.º 12
0
 def sign_up(self):
     c.fs = UserFields.bind(model.User)
     return render('/auth/sign_up.html')
Exemplo n.º 13
0
 def new(self):
     c.fs = DomainFields
     return render('domains/new.html')
Exemplo n.º 14
0
 def index(self):
     c.domains = meta.Session.query(model.Domain).all()
     return render('domains/index.html')
Exemplo n.º 15
0
 def new(self, domain_id):
     c.fs = RecordFields.bind(model.Record)
     return render('records/new.html')
Exemplo n.º 16
0
 def edit(self, id, format='html'):
     user = meta.Session.query(model.User).filter_by(id=id).first()
     user.encrypted_password = ''
     c.fs = UserFields.bind(user)
     return render('users/edit.html')
Exemplo n.º 17
0
 def edit(self, id, format='html'):
     record = meta.Session.query(model.Record).filter_by(id=id).first()
     c.fs = RecordFields.bind(record)
     return render('records/edit.html')
Exemplo n.º 18
0
 def new(self):
     c.fs = UserFields
     return render('users/new.html')
Exemplo n.º 19
0
 def index(self):
     return render('home/index.html')
Exemplo n.º 20
0
 def index(self):
     c.users = meta.Session.query(model.User).all()
     return render('users/index.html')