Skip to content

Commit

Permalink
fix(history): returning triples makes only sense for RootObjects
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed May 14, 2024
1 parent 6f7c3dc commit cac40bf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apis_core/history/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any
from apis_core.generic.abc import GenericModel
from apis_core.apis_metainfo.models import RootObject
from django.urls import reverse
from simple_history.models import HistoricalRecords
from django.core.exceptions import AppRegistryNotReady
Expand Down Expand Up @@ -62,6 +63,9 @@ def get_triples_for_version(
If only_latest is True, only the latest version of a triple is returned."""
from apis_core.apis_relations.models import TempTriple

if not isinstance(self, RootObject):
return []

if history_date is None:
filter_date = (
self.next_record.history_date if self.next_record else datetime.now()
Expand Down

0 comments on commit cac40bf

Please sign in to comment.