lib.itmens/catalog/collection/models.py

20 lines
510 B
Python
Raw Normal View History

2024-05-27 15:44:12 -04:00
from typing import TYPE_CHECKING
from catalog.common import Item, ItemCategory
2022-12-12 16:46:37 +00:00
class Collection(Item):
2024-05-27 15:44:12 -04:00
if TYPE_CHECKING:
from journal.models import Collection as JournalCollection
journal_item: "JournalCollection"
2022-12-12 16:46:37 +00:00
category = ItemCategory.Collection
2023-01-14 09:48:30 -05:00
2024-12-30 01:51:19 -05:00
@property
def url(self):
return self.journal_item.url if hasattr(self, "journal_item") else super().url
2024-12-30 01:51:19 -05:00
2023-01-14 09:48:30 -05:00
@property
def owner_id(self):
return self.journal_item.owner_id if self.journal_item else None