diff --git a/src/pyanilist/_models.py b/src/pyanilist/_models.py index 1cf86e6..80b6b05 100644 --- a/src/pyanilist/_models.py +++ b/src/pyanilist/_models.py @@ -23,8 +23,8 @@ class ParentModel(BaseModel): """ - Parent Model that stores the global configuration - All models ahead will inherit from this + Parent Model that stores the global configuration. + All models ahead will inherit from this. """ model_config = ConfigDict( @@ -49,6 +49,9 @@ class MediaTitle(ParentModel): native: str | None = None """Official title in its native language""" + def __str__(self) -> str: + return self.english or self.romaji or self.native # type: ignore + class FuzzyDate(ParentModel): """Naive date object that allows for incomplete date values (fuzzy).""" @@ -97,6 +100,12 @@ def as_int(self) -> FuzzyDateInt: return int(f"{year}{month}{day}") + def __str__(self) -> str: + return self.iso_format() + + def __int__(self) -> int: + return self.as_int() + class MediaTrailer(ParentModel): """Media trailer or advertisement."""