|
@ -9,9 +9,9 @@ from atheneum.service import validation_service |
|
|
|
|
|
|
|
|
def get_patch_fields(patch_json: Dict[str, Any]) -> Set[str]: |
|
|
def get_patch_fields(patch_json: Dict[str, Any]) -> Set[str]: |
|
|
"""Convert json fields to python fields.""" |
|
|
"""Convert json fields to python fields.""" |
|
|
return set([ |
|
|
|
|
|
|
|
|
return { |
|
|
transformation_service.convert_key_from_json(key) for key in |
|
|
transformation_service.convert_key_from_json(key) for key in |
|
|
patch_json.keys()]) |
|
|
|
|
|
|
|
|
patch_json.keys()} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def perform_patch(request_user: User, |
|
|
def perform_patch(request_user: User, |
|
@ -108,9 +108,8 @@ def patch( |
|
|
patch_model, |
|
|
patch_model, |
|
|
model_attributes, |
|
|
model_attributes, |
|
|
patched_fields) |
|
|
patched_fields) |
|
|
else: |
|
|
|
|
|
raise ValueError( |
|
|
|
|
|
'Model types "{}" and "{}" do not match'.format( |
|
|
|
|
|
original_model.__class__.__name__, |
|
|
|
|
|
patch_model.__class__.__name__ |
|
|
|
|
|
)) |
|
|
|
|
|
|
|
|
raise ValueError( |
|
|
|
|
|
'Model types "{}" and "{}" do not match'.format( |
|
|
|
|
|
original_model.__class__.__name__, |
|
|
|
|
|
patch_model.__class__.__name__ |
|
|
|
|
|
)) |