#36 Quality checks
* refactors toggling of recorded status into RecordableMixin
This commit is contained in:
+1
-17
@@ -486,21 +486,5 @@ class RecordModalForm(BaseModalForm):
|
||||
def save(self):
|
||||
with transaction.atomic():
|
||||
if self.cleaned_data["confirm"]:
|
||||
if self.instance.recorded:
|
||||
# unrecord!
|
||||
unrecord_action = UserActionLogEntry.objects.create(
|
||||
user=self.user,
|
||||
action=UserAction.UNRECORDED
|
||||
)
|
||||
# Do not delete the old .recorded attribute, since it shall stay in the .log list!
|
||||
self.instance.recorded = None
|
||||
self.instance.log.add(unrecord_action)
|
||||
else:
|
||||
record_action = UserActionLogEntry.objects.create(
|
||||
user=self.user,
|
||||
action=UserAction.RECORDED
|
||||
)
|
||||
self.instance.recorded = record_action
|
||||
self.instance.log.add(record_action)
|
||||
self.instance.save()
|
||||
self.instance.toggle_recorded(self.user)
|
||||
return self.instance
|
||||
Reference in New Issue
Block a user