From 03e543e7f87746c89b97a4362a0929f6f5c0b823 Mon Sep 17 00:00:00 2001 From: Takeus <68923554+TakeusV1@users.noreply.github.com> Date: Sun, 2 Nov 2025 21:24:20 +0100 Subject: [PATCH] V1.6 - Add Notes field in inventory item --- app/forms.py | 5 ++++- app/models.py | 4 +++- app/routes/r_inventory.py | 7 +++++++ app/templates/panel/_modal.html | 7 ++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/forms.py b/app/forms.py index d551b35..f04d027 100644 --- a/app/forms.py +++ b/app/forms.py @@ -47,4 +47,7 @@ class ChangeInventoryItem(FlaskForm): item_owner = StringField(validators=[Length(max=64)]) item_contact = StringField(validators=[Length(max=64)]) # Allocation(s) - item_ip_allocations = StringField() \ No newline at end of file + item_ip_allocations = StringField() + # Others + item_notes = StringField() + \ No newline at end of file diff --git a/app/models.py b/app/models.py index cf6e222..0c67813 100644 --- a/app/models.py +++ b/app/models.py @@ -46,4 +46,6 @@ class Inventory(db.Model): host_owner = db.Column(db.String(64)) host_contact = db.Column(db.String(64)) ## Allocation(s) - host_allocations = db.Column(db.Text()) \ No newline at end of file + host_allocations = db.Column(db.Text()) + ### Others + host_notes = db.Column(db.Text()) \ No newline at end of file diff --git a/app/routes/r_inventory.py b/app/routes/r_inventory.py index 3ddde7c..f576c71 100644 --- a/app/routes/r_inventory.py +++ b/app/routes/r_inventory.py @@ -104,6 +104,7 @@ def item_view_modal(item_id): ('Owner',db_item.host_owner,'col-6'), ('Contact',db_item.host_contact,'col-6'), ('Allocations',db_item.host_allocations,'col-12'), + ('Notes',db_item.host_notes,'col-12'), ] return render_template('panel/_modal.html', modal=modal, item_id=item_id, informations=informations, old_page=request.args.get('page', type=int), pagination_active=True) @@ -175,6 +176,11 @@ def item_edit_modal(item_id): db_item.host_contact = form.item_contact.data else: db_item.host_contact = None + # Notes + if form.item_notes.data != '' and form.item_notes.data != 'None': + db_item.host_notes = form.item_notes.data + else: + db_item.host_notes = None # Allocations db_existing_allocs = Allocation.query.filter_by(device_id=db_item.id).all() @@ -219,6 +225,7 @@ def item_edit_modal(item_id): form.item_owner.default = db_item.host_owner form.item_contact.default = db_item.host_contact form.item_ip_allocations.default = db_item.host_allocations + form.item_notes.default = db_item.host_notes form.process() modal = { diff --git a/app/templates/panel/_modal.html b/app/templates/panel/_modal.html index 7b49fd3..1a0fac4 100644 --- a/app/templates/panel/_modal.html +++ b/app/templates/panel/_modal.html @@ -13,7 +13,12 @@