示例#1
0
 def post(self, key):
     
     key = db.Key(key)
     db.delete(key)
     
     offset = 0
     limit = 20
     l = List.all().fetch(limit, offset)
     
     return self.render_response('list/list.html', data=l, title='Lists', flash='List successfully deleted.')
示例#2
0
    def get(self):

        offset = int(self.request.args.get('offset', '0'))
        limit = int(self.request.args.get('limit', '20'))
        
        l = List.all().fetch(limit, offset)
        
        if len(l) == 0:
            l = False
        
        return self.render_response('list/list.html', data=l, title='Lists', next_limit=limit+20, next_offset=limit, prev_offset=offset-20)
示例#3
0
    def post(self):

        form = get_list_form(self.request)
        
        if form.validate():
            l = List(key_name=str(form.name.data).lower().replace(' ','-'), name=form.name.data, description=form.description.data).put()
            
            offset = 0
            limit = 20
            l = List.all().fetch(limit, offset)
            
            return self.render_response('list/list.html', data=l, title='Lists', flash='List successfully created.')
            
        else:
            return Response('<b>Form could not be validated. :(</b>')
示例#4
0
    def post(self, key):

        entry = db.get(db.Key(key))
        form = get_list_form(self.request, entry)
        
        if form.validate():
            entry.name = form.name.data
            entry.description = form.description.data
            
            entry.put()
            
            offset = 0
            limit = 20
        
            l = List.all().fetch(limit, offset)

            return self.render_response('list/list.html', data=l, title='Lists', flash='List successfully saved.')
            
        else:
            return Response('<b>Form could not be validated. :(</b>')