#31 API POST/PUT Intervention
* splits code in smaller, reusable methods * adds put method to view * adds update_model_from_json() method
This commit is contained in:
@@ -78,6 +78,20 @@ class AbstractModelAPISerializer:
|
||||
serialized_data = self.model_to_geo_json(entry)
|
||||
return serialized_data
|
||||
|
||||
@abstractmethod
|
||||
def update_model_from_json(self, id, json_model, user):
|
||||
""" Updates an instance from given json data
|
||||
|
||||
Args:
|
||||
id (str): The instance's to be updated
|
||||
json_model (dict): JSON data
|
||||
user (User): The performing user
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
raise NotImplementedError("Must be implemented in subclasses")
|
||||
|
||||
@abstractmethod
|
||||
def create_model_from_json(self, json_model, user):
|
||||
""" Creates a new instance from given json data
|
||||
|
||||
Reference in New Issue
Block a user