Adds deposit field in Computer

This commit is contained in:
emmdim 2019-12-11 00:35:17 +01:00 committed by nad
parent 4fc6378258
commit 91f5fa4e75
3 changed files with 6 additions and 2 deletions

View file

@ -375,9 +375,10 @@ class Computer(Device):
id = Column(BigInteger, ForeignKey(Device.id), primary_key=True) id = Column(BigInteger, ForeignKey(Device.id), primary_key=True)
chassis = Column(DBEnum(ComputerChassis), nullable=False) chassis = Column(DBEnum(ComputerChassis), nullable=False)
chassis.comment = """The physical form of the computer. chassis.comment = """The physical form of the computer.
It is a subset of the Linux definition of DMI / DMI decode. It is a subset of the Linux definition of DMI / DMI decode.
""" """
deposit = Column(Integer, check_range('deposit',min=0,max=100), default=0)
def __init__(self, chassis, **kwargs) -> None: def __init__(self, chassis, **kwargs) -> None:
chassis = ComputerChassis(chassis) chassis = ComputerChassis(chassis)

View file

@ -141,6 +141,7 @@ class DisplayMixin:
class Computer(DisplayMixin, Device): class Computer(DisplayMixin, Device):
components = ... # type: Column components = ... # type: Column
chassis = ... # type: Column chassis = ... # type: Column
deposit = ... # type: Column
def __init__(self, **kwargs) -> None: def __init__(self, **kwargs) -> None:
super().__init__(**kwargs) super().__init__(**kwargs)

View file

@ -121,7 +121,9 @@ class Computer(Device):
dump_only=True, dump_only=True,
collection_class=set, collection_class=set,
description=m.Computer.privacy.__doc__) description=m.Computer.privacy.__doc__)
deposit = Integer(dump_only=True,
data_key='deposit',
description=m.Computer.deposit.__doc__)
class Desktop(Computer): class Desktop(Computer):
__doc__ = m.Desktop.__doc__ __doc__ = m.Desktop.__doc__