Removed the unused __entry pseudo property from the JournalEntryForm form.

This commit is contained in:
依瑪貓 2023-03-17 22:52:38 +08:00
parent 08d1e60238
commit 56045f0faf

View File

@ -344,26 +344,6 @@ class JournalEntryForm(FlaskForm):
return None if self.__original_entry is None \
else str(self.__original_entry)
@property
def __entry(self) -> JournalEntry | None:
"""Returns the journal entry.
:return: The journal entry.
"""
if not hasattr(self, "____entry"):
def get_entry() -> JournalEntry | None:
if self.eid.data is None:
return None
return JournalEntry.query\
.filter(JournalEntry.id == self.eid.data)\
.options(selectinload(JournalEntry.transaction),
selectinload(JournalEntry.account),
selectinload(JournalEntry.offsets)
.selectinload(JournalEntry.transaction))\
.first()
setattr(self, "____entry", get_entry())
return getattr(self, "____entry")
@property
def is_original_entry(self) -> bool:
"""Returns whether the entry is an original entry.