Chore: remove unused Tag.parent_pk

It was an alias of tn_parent_id used only by two test asserts, which now use tn_parent_id directly.
This commit is contained in:
Trenton H committed 2026-11-16 07:19:12 -08:00
1 parent 1326378a90
commit e1bd11d0e4
2 files changed
+2 -6

No files matched your search

-4
View File
@@ -138,10 +138,6 @@ class Tag(MatchingModel):
return TagHierarchy(cls.objects.values_list("pk", "tn_parent_id"))
@property
def parent_pk(self) -> int | None:
return self.tn_parent_id
def get_parent(self) -> "Tag | None":
return self.tn_parent
+2 -2
View File
@@ -362,7 +362,7 @@ class TestTagHierarchy(DirectoriesMixin, APITestCase):
x = Tag.objects.create(name="X2")
y = Tag.objects.create(name="Y2", tn_parent=x)
assert y.parent_pk == x.pk
assert y.tn_parent_id == x.pk
# Moving X under D would make deepest node Y exceed depth 5 -> reject
resp_fail = self.client.patch(
@@ -383,7 +383,7 @@ class TestTagHierarchy(DirectoriesMixin, APITestCase):
)
assert resp_ok.status_code in (200, 202)
x.refresh_from_db()
assert x.parent_pk == c.id
assert x.tn_parent_id == c.id
def test_is_root_filter_returns_only_root_tags(self) -> None:
other_root = Tag.objects.create(name="Other parent")