#31 API DELETE
* adds support for DELETE method for all relevant objects * improves get_obj_from_db functionality * drops custom compensation logic for get_obj_from_db due to improvement of base method
This commit is contained in:
@@ -129,23 +129,6 @@ class CompensationAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensa
|
||||
|
||||
return obj.id
|
||||
|
||||
def get_obj_from_db(self, id, user):
|
||||
""" Returns the object from database
|
||||
|
||||
Fails if id not found or user does not have shared access
|
||||
|
||||
Args:
|
||||
id (str): The object's id
|
||||
user (User): The API user
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
return self.model.objects.get(
|
||||
id=id,
|
||||
intervention__users__in=[user]
|
||||
)
|
||||
|
||||
def update_model_from_json(self, id, json_model, user):
|
||||
""" Updates an entry for the model based on the contents of json_model
|
||||
|
||||
|
||||
Reference in New Issue
Block a user