#86 Log detail enhancements

* restructures removing of related data into separate sub-delete forms for easier logic handling
This commit is contained in:
2022-02-08 13:16:20 +01:00
parent 13fd3e1fcb
commit 6cdf355063
21 changed files with 206 additions and 75 deletions

View File

@@ -47,14 +47,3 @@ class CompensationState(UuidModel):
def __str__(self):
return f"{self.biotope_type} | {self.surface}"
def delete(self, user=None, *args, **kwargs):
from compensation.models import Compensation
if user:
comps = Compensation.objects.filter(
Q(before_states__id__in=[self.id]) |
Q(after_states__id__in=[self.id])
).distinct()
for comp in comps:
comp.mark_as_edited(user, edit_comment=COMPENSATION_STATE_REMOVED)
super().delete(*args, **kwargs)