Skip to content

Commit

Permalink
Merge pull request #11648 from archesproject/jtw/fix-dupe-whatisthis
Browse files Browse the repository at this point in the history
Fix duplicate results in `whatisthis` command
  • Loading branch information
whatisgalen authored Jan 2, 2025
2 parents 02f2d8c + bdbe8a9 commit 872ea7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions arches/management/commands/whatisthis.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def find_uuid(self, in_uuid):
## search all models and see if the UUID matches an existing object
objs = []
for m in django.apps.apps.get_models():
if m._meta.proxy:
continue
if not m.__module__.startswith("arches"):
continue
if m._meta.pk.get_internal_type() != "UUIDField":
Expand Down
3 changes: 1 addition & 2 deletions tests/commands/test_whatisthis.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def test_match(self):
g = Graph.new()
out = StringIO()
call_command("whatisthis", str(g.pk), stdout=out)
# Produces hits on graph and node
self.assertIn("This UUID is the primary key for 2 objects:", out.getvalue())
self.assertIn("This UUID is the primary key for 1 object:", out.getvalue())

def test_no_match(self):
out = StringIO()
Expand Down

0 comments on commit 872ea7c

Please sign in to comment.