#31 API POST Compensation

* adds support for POST of new compensations
* adds shared_users property to BaseObject and Compensation to simplify fetching of shared users (Compensation inherits from intervention)
* extends compensation admin index
* modifies compensation manager which led to invisibility of deleted entries in the admin backend
* fixes bug in sanitize_db.py where CREATED useractions would be removed if they are not found on any log but still are used on the .created attribute of the objects
This commit is contained in:
2022-01-24 14:41:56 +01:00
parent 314879a1fe
commit 2fa2876090
8 changed files with 237 additions and 10 deletions

View File

@@ -10,7 +10,7 @@ from ema.models import Ema
from intervention.models import Intervention
from konova.management.commands.setup import BaseKonovaCommand
from konova.models import Deadline, Geometry, Parcel, District
from user.models import UserActionLogEntry
from user.models import UserActionLogEntry, UserAction
class Command(BaseKonovaCommand):
@@ -55,7 +55,11 @@ class Command(BaseKonovaCommand):
"""
self._write_warning("=== Sanitize log entries ===")
all_log_entries = UserActionLogEntry.objects.all()
# Exclude created log entries from being cleaned, since they can be part of objects which do not have logs
# Being in a log (or not) is essential for this cleanup
all_log_entries = UserActionLogEntry.objects.all().exclude(
action=UserAction.CREATED
)
intervention_log_entries_ids = self.get_all_log_entries_ids(Intervention)
attached_log_entries_id = intervention_log_entries_ids.union(