Refactoring
* adds simple getter methods for UserActionLogEntry * replaces manual creation of UserActionLogEntry with new methods
This commit is contained in:
@@ -108,11 +108,7 @@ class BaseObject(BaseResource):
|
||||
return
|
||||
|
||||
with transaction.atomic():
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserAction.DELETED,
|
||||
timestamp=timezone.now()
|
||||
)
|
||||
action = UserActionLogEntry.get_deleted_action(user)
|
||||
self.deleted = action
|
||||
self.log.add(action)
|
||||
self.save()
|
||||
@@ -207,10 +203,7 @@ class RecordableObjectMixin(models.Model):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserAction.UNRECORDED
|
||||
)
|
||||
action = UserActionLogEntry.get_unrecorded_action(user)
|
||||
self.recorded = None
|
||||
self.save()
|
||||
self.log.add(action)
|
||||
@@ -225,10 +218,7 @@ class RecordableObjectMixin(models.Model):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserAction.RECORDED
|
||||
)
|
||||
action = UserActionLogEntry.get_recorded_action(user)
|
||||
self.recorded = action
|
||||
self.save()
|
||||
self.log.add(action)
|
||||
@@ -287,10 +277,7 @@ class CheckableObjectMixin(models.Model):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserAction.CHECKED
|
||||
)
|
||||
action = UserActionLogEntry.get_checked_action(user)
|
||||
self.checked = action
|
||||
self.save()
|
||||
self.log.add(action)
|
||||
|
||||
Reference in New Issue
Block a user