Fix data model before generating migration

This commit is contained in:
Midgard 2020-01-26 03:04:17 +01:00
parent e46d5e622e
commit 9588116ba7
Signed by: midgard
GPG key ID: 511C112F1331BBB4
2 changed files with 21 additions and 2 deletions

View file

@ -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

View 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)