Fix data model before generating migration
This commit is contained in:
parent
e46d5e622e
commit
9588116ba7
2 changed files with 21 additions and 2 deletions
|
@ -30,9 +30,8 @@ order_item
|
|||
|
||||
order_item_choice
|
||||
id
|
||||
order_item_id
|
||||
choice_id HLDS identifier
|
||||
kind single_choice/multi_choice
|
||||
order_item
|
||||
name
|
||||
description
|
||||
value just a textual description of the chosen values
|
||||
|
|
20
app/models/orderitemchoice.py
Normal file
20
app/models/orderitemchoice.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from datetime import datetime
|
||||
|
||||
from .database import db
|
||||
from .orderitem import OrderItem
|
||||
|
||||
|
||||
class OrderItemChoice(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
choice_id = db.Column(db.String(64), nullable=True)
|
||||
order_item_id = db.Column(db.Integer, db.ForeignKey("orderitem.id"), nullable=False)
|
||||
kind = db.Column(db.String(1), nullable=False)
|
||||
name = db.Column(db.String(120), nullable=True)
|
||||
value = db.Column(db.String(120), nullable=True)
|
||||
|
||||
# pylint: disable=attribute-defined-outside-init
|
||||
def configure(self, order: OrderItem) -> None:
|
||||
self.order = order
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "{}: {}".format(self.name, self.value)
|
Loading…
Reference in a new issue