Skip to content

Commit

Permalink
nit #11570
Browse files Browse the repository at this point in the history
  • Loading branch information
chrabyrd committed Nov 20, 2024
1 parent e2a7fc7 commit 23234ad
Show file tree
Hide file tree
Showing 2 changed files with 668 additions and 616 deletions.
23 changes: 9 additions & 14 deletions arches/app/models/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2313,22 +2313,17 @@ def validate_fieldname(fieldname, fieldnames):
.exclude(source_identifier__isnull=False)
.filter(slug=self.slug)
)
if (
first_matching_graph := graphs_with_matching_slug.first()
) and first_matching_graph.graphid != self.graphid:
if self.source_identifier_id:
if self.source_identifier_id != first_matching_graph.graphid:
raise GraphValidationError(
_(
"Another resource model already uses the slug '{self.slug}'"
).format(**locals()),
1007,
)
else:
if (first_matching_graph := graphs_with_matching_slug.first()) and str(
first_matching_graph.graphid
) != str(self.graphid):
if (
not self.source_identifier_id
or self.source_identifier_id != first_matching_graph.graphid
):
raise GraphValidationError(
_(
"Another resource model already uses the slug '{self.slug}'"
).format(**locals()),
"Another resource model already uses the slug '{slug}'"
).format(slug=self.slug),
1007,
)

Expand Down
Loading

0 comments on commit 23234ad

Please sign in to comment.