#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:
@@ -29,6 +29,7 @@ class CompensationAdmin(BaseObjectAdmin):
|
||||
"identifier",
|
||||
"title",
|
||||
"created",
|
||||
"deleted",
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,7 @@ class CompensationManager(models.Manager):
|
||||
|
||||
"""
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().filter(
|
||||
deleted__isnull=True,
|
||||
).select_related(
|
||||
return super().get_queryset().select_related(
|
||||
"modified",
|
||||
"intervention",
|
||||
"intervention__recorded",
|
||||
|
||||
@@ -245,6 +245,15 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin):
|
||||
# Compensations inherit their shared state from the interventions
|
||||
return self.intervention.is_shared_with(user)
|
||||
|
||||
@property
|
||||
def shared_users(self) -> QuerySet:
|
||||
""" Shortcut for fetching the users which have shared access on this object
|
||||
|
||||
Returns:
|
||||
users (QuerySet)
|
||||
"""
|
||||
return self.intervention.users.all()
|
||||
|
||||
def get_LANIS_link(self) -> str:
|
||||
""" Generates a link for LANIS depending on the geometry
|
||||
|
||||
|
||||
Reference in New Issue
Block a user