Example #1
0
 def run(self, request, context):
     """
     Удаляться одновременно могут несколько объектов. Их ключи
     приходят разделенные запятыми.
     """
     ids = utils.extract_int_list(request, 'id')
     objs = [self.parent.get_row(id) for id in ids]
     result = self.parent.delete_row(objs)
     if (isinstance(result, OperationResult) and
             result.success is True and
             'm3_audit' in settings.INSTALLED_APPS):
         for obj in objs:
             AuditManager().write(
                 'dict-changes',
                 user=request.user,
                 model_object=obj,
                 type='delete')
     return result
Example #2
0
    def run(self, request, context):
        """
        Удаляться одновременно могут несколько объектов. Их ключи
        приходят разделенные запятыми.
        """
        ids = utils.extract_int_list(request, 'id')
        try:
            objs = [self.parent.get_row(id) for id in ids]
        except self.parent._nofound_exception:
            return OperationResult.by_message(MSG_DOESNOTEXISTS % id)

        result = self.parent.delete_row(objs)
        if (isinstance(result, OperationResult) and result.success is True
                and 'm3_audit' in settings.INSTALLED_APPS):
            for obj in objs:
                AuditManager().write('dict-changes',
                                     user=request.user,
                                     model_object=obj,
                                     type='delete')
        return result
Example #3
0
 def run(self, request, context):
     ids = utils.extract_int_list(request, 'id')
     dest_id = utils.extract_int(request, 'dest_id')
     return self.parent.drag_item(ids, dest_id)