コード例 #1
0
ファイル: appviews.py プロジェクト: pombredanne/djpcms
 def post_response(self, request):
     qs = self.query(request)
     num = qs.count()
     qs.delete()
     if request.is_xhr:
         c = ajax.jcollection(request.environ)
         for instance in qs:
             c.append(ajax.jremove(None, "#" + instance.id))
         return c
     else:
         url = get_redirect(request, force_redirect=True)
         return self.redirect(url)
コード例 #2
0
 def ajax__bulk_delete(self, request):
     '''An ajax view for deleting a list of ids.'''
     objs = self.get_instances(request)
     mapper = self.mapper
     c = ajax.jcollection(request.environ)
     if objs is not None:
         objs = objs.delete()
     if objs:
         for id in objs:
             id = mapper.unique_id(id)
             c.add(ajax.jremove(request.environ, '#' + id))
     return c
コード例 #3
0
 def post_response(self, request):
     qs = self.query(request)
     num = qs.count()
     qs.delete()
     if request.is_xhr:
         c = ajax.jcollection(request.environ)
         for instance in qs:
             c.append(ajax.jremove(None, '#' + instance.id))
         return c
     else:
         url = get_redirect(request, force_redirect=True)
         return self.redirect(url)
コード例 #4
0
ファイル: application.py プロジェクト: pombredanne/djpcms
 def ajax__bulk_delete(self, request):
     '''An ajax view for deleting a list of ids.'''
     objs = self.get_instances(request)
     mapper = self.mapper
     c = ajax.jcollection(request.environ)
     if objs is not None:
         objs = objs.delete()
     if objs:
         for id in objs:
             id = mapper.unique_id(id)
             c.add(ajax.jremove(request.environ, '#'+id))
     return c
コード例 #5
0
ファイル: blocks.py プロジェクト: pombredanne/djpcms
    def post_response(self, request):
        if not request.is_xhr:
            raise ValueError()
        instance = request.instance
        column = instance.column
        jquery = ajax.jcollection(request.environ)
        blockcontents = [b for b in self.mapper.filter(page=instance.page)\
                         if b.column==column]
        if instance.position == len(blockcontents) - 1:
            return jquery

        jatt = ajax.jattribute(request.environ)
        pos = 0
        for b in blockcontents:
            if b == instance:
                jquery.add(ajax.jremove(None, '#' + instance.htmlid()))
                b.delete()
                continue
            if b.position != pos:
                b.position = pos
                b.save()
            pos += 1
        jquery.add(jatt)
        return jquery
コード例 #6
0
ファイル: blocks.py プロジェクト: pombredanne/djpcms
    def post_response(self, request):
        if not request.is_xhr:
            raise ValueError()
        instance = request.instance
        column = instance.column
        jquery = ajax.jcollection(request.environ)
        blockcontents = [b for b in self.mapper.filter(page=instance.page)\
                         if b.column==column]
        if instance.position == len(blockcontents) - 1:
            return jquery

        jatt   = ajax.jattribute(request.environ)
        pos    = 0
        for b in blockcontents:
            if b == instance:
                jquery.add(ajax.jremove(None, '#'+instance.htmlid()))
                b.delete()
                continue
            if b.position != pos:
                b.position = pos
                b.save()
            pos += 1
        jquery.add(jatt)
        return jquery