#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:
@@ -46,16 +46,18 @@ class InterventionAPISerializerV1(AbstractModelAPISerializerV1):
|
||||
Returns:
|
||||
obj (Intervention)
|
||||
"""
|
||||
create_action = UserActionLogEntry.get_created_action(user, comment="API Import")
|
||||
# Create geometry
|
||||
json_geom = self.create_geometry_from_json(json_model)
|
||||
geometry = Geometry()
|
||||
geometry.geom = json_geom
|
||||
geometry.created = create_action
|
||||
|
||||
# Create linked objects
|
||||
obj = Intervention()
|
||||
resp = Responsibility()
|
||||
legal = Legal()
|
||||
created = UserActionLogEntry.get_created_action(user, comment="API Import")
|
||||
created = create_action
|
||||
obj.legal = legal
|
||||
obj.created = created
|
||||
obj.geometry = geometry
|
||||
@@ -131,6 +133,7 @@ class InterventionAPISerializerV1(AbstractModelAPISerializerV1):
|
||||
obj.save()
|
||||
|
||||
obj.users.add(user)
|
||||
obj.log.add(obj.created)
|
||||
|
||||
celery_update_parcels.delay(obj.geometry.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user