diff --git a/app/api/main.py b/app/api/main.py index 07655356ad1a5a4225c97299c44010226304755d..9bdf0b5af37dbc53e23dcabbcd7912d02a3ef475 100644 --- a/app/api/main.py +++ b/app/api/main.py @@ -98,7 +98,6 @@ def patch_item(item_id): item = Item.query.get(item_id) if item is None: raise utils.InventoryError(f'Unknown item id: {item_id}', status_code=422) - item.name = data.get('name', item.name) item.manufacturer = utils.convert_to_model(data.get('manufacturer', item.manufacturer), Manufacturer) item.model = utils.convert_to_model(data.get('model', item.model), Model) item.location = utils.convert_to_model(data.get('location', item.location), Location) diff --git a/app/main/views.py b/app/main/views.py index bed5b67f479db311f94139fda936690f46ea5386..f46aef86d90c97a1456e40437c51104a61c162c1 100644 --- a/app/main/views.py +++ b/app/main/views.py @@ -42,7 +42,6 @@ def retrieve_items(): items = Item.query.order_by(Item._created) data = [[item.id, item.serial_number, - item.name, utils.format_field(item.manufacturer), utils.format_field(item.model), utils.format_field(item.location), diff --git a/app/models.py b/app/models.py index 40680d58b15f8e6d09009eb05d09ddf8214d0cae..066f55436bf0d08550fd6276bfcd1dda3c2542d9 100644 --- a/app/models.py +++ b/app/models.py @@ -220,7 +220,6 @@ class Item(db.Model): _created = db.Column(db.DateTime, default=db.func.now()) _updated = db.Column(db.DateTime, default=db.func.now(), onupdate=db.func.now()) serial_number = db.Column(db.String(100), nullable=False) - name = db.Column(db.String(100)) hash = db.Column(GUID, unique=True) manufacturer_id = db.Column(db.Integer, db.ForeignKey('manufacturer.id')) model_id = db.Column(db.Integer, db.ForeignKey('model.id')) @@ -234,10 +233,9 @@ class Item(db.Model): status = db.relationship('Status', back_populates='items') children = db.relationship('Item', backref=db.backref('parent', remote_side=[id])) - def __init__(self, serial_number=None, name=None, manufacturer=None, model=None, location=None, status=None): + def __init__(self, serial_number=None, manufacturer=None, model=None, location=None, status=None): # All arguments must be optional for this class to work with flask-admin! self.serial_number = serial_number - self.name = name self.manufacturer = utils.convert_to_model(manufacturer, Manufacturer) self.model = utils.convert_to_model(model, Model) self.location = utils.convert_to_model(location, Location) @@ -251,7 +249,6 @@ class Item(db.Model): return { 'id': self.id, 'serial_number': self.serial_number, - 'name': self.name, 'hash': self.hash, 'manufacturer': utils.format_field(self.manufacturer), 'model': utils.format_field(self.model), diff --git a/app/templates/index.html b/app/templates/index.html index d110d2455d05db6b3a5894fdde431dae97853140..b70bb36a839e9e9f21aba9c73c5eab7d259e615e 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -10,7 +10,6 @@ <tr> <th>Id</th> <th>Serial number</th> - <th>name</th> <th>Manufacturer</th> <th>Model</th> <th>Location</th>