Beispiel #1
0
    def login(req):
        errors = []
        if req.user.is_authenticated:
            return Controller.goto('/collect/index')

        if req.method == "POST":
            username = req.POST.get('username')
            password = req.POST.get('password')
            user = authenticate(req, username=username, password=password)
            if user is not None:
                login(req, user)
                return Controller.goto('/collect/index')
            errors.append("Hmm I cant find that user/password combo")

        ctx = {"errors": errors}
        return Controller.render(req, ctx, 'login/login.html')
Beispiel #2
0
 def read(req):
   if req.method != 'POST':
       return Controller.goto('/collect/index')
   path  = req.POST.get('path')
   data  = {'status':'processing', 'name': os.path.basename(path), 'create_by': req.user.username }
   mkdir, created = Directory.objects.get_or_create(full_path=path, defaults=data,)
   sect  = req.POST.get('section-select')
   loc   = req.POST.get('location-select')
   sect_obj = Section.objects.filter(id=1).values('id', 'name')[0]
   loc_obj  = Location.objects.filter().values('id', 'name')[0]
   ctx = {"path": path, "section_id":sect, "sect_obj":sect_obj, 'loc_id':loc, 'loc_obj':loc_obj, "mkdir": mkdir}
   return Controller.render(req, ctx, 'collect/read.html')
Beispiel #3
0
 def logout(req):
     logout(req)
     return Controller.goto('index')
Beispiel #4
0
 def index(req):
   return Controller.goto('index/index.html')