# Mass delete command
* introduces new command for mass deleting entries based on specific pattern in identifier
* command guides user through parameter collecting process
This commit is contained in:
@@ -92,13 +92,15 @@ class DeletableObjectMixin(models.Model):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def mark_as_deleted(self, user, send_mail: bool = True):
|
||||
def mark_as_deleted(self, user, send_mail: bool = True, comment: str|None = None):
|
||||
""" Mark an entry as deleted
|
||||
|
||||
Does not delete from database but sets a timestamp for being deleted on and which user deleted the object
|
||||
|
||||
Args:
|
||||
user (User): The performing user
|
||||
send_mail (bool): Whether to send mails to users and teams
|
||||
comment (str|None): The comment for delete action
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -109,7 +111,7 @@ class DeletableObjectMixin(models.Model):
|
||||
return
|
||||
|
||||
with transaction.atomic():
|
||||
action = UserActionLogEntry.get_deleted_action(user)
|
||||
action = UserActionLogEntry.get_deleted_action(user, comment)
|
||||
self.deleted = action
|
||||
self.log.add(action)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user