Enhance model constructors; add optional parameters for improved initialization across multiple modelsOh
This commit is contained in:
parent
acacf39f8e
commit
8162038f40
10 changed files with 90 additions and 13 deletions
|
@ -28,6 +28,19 @@ class WorkLog(db.Model):
|
|||
work_item: Mapped[Optional['Inventory']] = relationship('Inventory', back_populates='work_logs')
|
||||
contact: Mapped[Optional['User']] = relationship('User', back_populates='work_logs')
|
||||
|
||||
def __init__(self, start_time: Optional[datetime.datetime] = None, end_time: Optional[datetime.datetime] = None,
|
||||
notes: Optional[str] = None, complete: Optional[bool] = False,
|
||||
followup: Optional[bool] = False, contact_id: Optional[int] = None,
|
||||
analysis: Optional[bool] = False, work_item_id: Optional[int] = None):
|
||||
self.start_time = start_time
|
||||
self.end_time = end_time
|
||||
self.notes = notes
|
||||
self.complete = complete
|
||||
self.followup = followup
|
||||
self.contact_id = contact_id
|
||||
self.analysis = analysis
|
||||
self.work_item_id = work_item_id
|
||||
|
||||
def __repr__(self):
|
||||
return f"<WorkLog(id={self.id}, start_time={self.start_time}, end_time={self.end_time}, " \
|
||||
f"notes={repr(self.notes)}, complete={self.complete}, followup={self.followup}, " \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue