Skip to content

Commit

Permalink
Merge pull request #37 from openimis/feature/OFS-178
Browse files Browse the repository at this point in the history
OFS-178: ObjectDoesNotExist exception - use filter instead of get
  • Loading branch information
delcroip authored Jan 20, 2021
2 parents 1fff261 + d8fef05 commit 36b0a0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def delete(self, *args, **kwargs):
if hasattr(self, "replacement_uuid"):
# When a replacement entity is deleted, the link should be removed
# from replaced entity so a new replacement could be generated
replaced_entity = self.__class__.objects.get(replacement_uuid=self.id)
replaced_entity = self.__class__.objects.filter(replacement_uuid=self.id).first()
if replaced_entity:
replaced_entity.replacement_uuid = None
replaced_entity.save(username="admin")
Expand Down

0 comments on commit 36b0a0a

Please sign in to comment.