mirror of
https://github.com/TakeusV1/flask_ipam.git
synced 2026-10-13 17:15:33 +02:00
V1.6
- Add Notes field in inventory item
This commit is contained in:
1 parent
5c5a174209
commit
03e543e7f8
4 files changed
+18
-1
No files matched your search
@@ -48,3 +48,6 @@ class ChangeInventoryItem(FlaskForm):
|
||||
item_contact = StringField(validators=[Length(max=64)])
|
||||
# Allocation(s)
|
||||
item_ip_allocations = StringField()
|
||||
# Others
|
||||
item_notes = StringField()
|
||||
|
||||
@@ -47,3 +47,5 @@ class Inventory(db.Model):
|
||||
host_contact = db.Column(db.String(64))
|
||||
## Allocation(s)
|
||||
host_allocations = db.Column(db.Text())
|
||||
### Others
|
||||
host_notes = db.Column(db.Text())
|
||||
@@ -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 = {
|
||||
|
||||
@@ -13,7 +13,12 @@
|
||||
<div class="row">
|
||||
{% for entry in form %}
|
||||
{% if entry.id != 'csrf_token' %}
|
||||
{% if entry.id == 'item_ip_allocations' %}
|
||||
{% if entry.id == 'item_notes' %}
|
||||
<div class="col-12">
|
||||
{{ entry.label(class="form-label") }}<br>
|
||||
{{ entry(class="form-control",placeholder='Notes, EX : Patch Panel/Switch...') }}
|
||||
</div>
|
||||
{% elif entry.id == 'item_ip_allocations' %}
|
||||
<div class="col-12">
|
||||
{{ entry.label(class="form-label") }}<br>
|
||||
{{ entry(class="form-control",placeholder='192.168.1.1,192.168.1.2 (separate with ,)') }}
|
||||
|
||||
Reference in new issue
Block a user