Skip to content

Commit

Permalink
add childco conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
acwhite211 committed Dec 20, 2024
1 parent a4db8ea commit f01ca5e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions specifyweb/specify/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,11 @@ def create_obj(collection, agent, model, data: Dict[str, Any], parent_obj=None):
model = get_model_or_404(model)
data = cleanData(model, data, agent)
obj = model()
if obj._meta.model_name == 'collectionobjectgroupjoin' and parent_obj._meta.model_name == 'collectionobject':
if (
obj._meta.model_name == "collectionobjectgroupjoin"
and parent_obj._meta.model_name == "collectionobject"
and data["childco"] == "/api/specify/collectionobject/"
):
parent_obj.save() # temporary fix for saving co cojo.childco
data['childco'] = f"{data['childco']}{parent_obj.id}/"
handle_fk_fields(collection, agent, obj, data)
Expand Down Expand Up @@ -1083,4 +1087,4 @@ def _handle_special_save_priors(obj):

def _handle_special_update_priors(obj, data):
data = modify_update_of_interaction_sibling_preps(obj, data)
pass
pass

0 comments on commit f01ca5e

Please sign in to comment.