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
|
@ -16,6 +16,10 @@ class Item(db.Model):
|
|||
|
||||
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='item')
|
||||
|
||||
def __init__(self, description: Optional[str] = None, category: Optional[str] = None):
|
||||
self.description = description
|
||||
self.category = category
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Item(id={self.id}, description={repr(self.description)}, category={repr(self.category)})>"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue