Update r_base.py

This commit is contained in:
Takeus committed 2025-02-12 14:51:09 +01:00
1 parent bcd6469572
commit 711d1fbba3
1 file changed
+12 -1
+12 -1
View File
@@ -177,7 +177,10 @@ def allocation_edit_modal(net_id, ipv4):
'action_text': 'Save', 'action_text': 'Save',
'form_url': url_for('base.allocation_edit_modal',net_id=db_alloc.net_id,ipv4=db_alloc.ipv4), 'form_url': url_for('base.allocation_edit_modal',net_id=db_alloc.net_id,ipv4=db_alloc.ipv4),
} }
return render_template('panel/_modal.html', modal=modal, form=form, old_page=request.args.get('page', type=int), pagination_active=True) old_page = request.args.get('page', type=int)
if old_page == 0:
old_page = 1
return render_template('panel/_modal.html', modal=modal, form=form, old_page=old_page, pagination_active=True)
## MODIFICATION ROUTES ## MODIFICATION ROUTES
@base.get('/network/<int:net_id>/allocations/<string:ipv4>/unallocate') @base.get('/network/<int:net_id>/allocations/<string:ipv4>/unallocate')
@@ -187,6 +190,8 @@ def allocation_delete(net_id,ipv4):
db_alloc.is_used = False db_alloc.is_used = False
db_alloc.hostname = None db_alloc.hostname = None
db_alloc.description = None db_alloc.description = None
db_alloc.is_dhcp = False
db_alloc.is_gateway = False
db.session.commit() db.session.commit()
flash("Allocation Deleted", 'warning') flash("Allocation Deleted", 'warning')
return redirect(url_for('base.allocations',net_id=net_id,page=request.args.get('page', type=int))) return redirect(url_for('base.allocations',net_id=net_id,page=request.args.get('page', type=int)))
@@ -245,6 +250,12 @@ def allocation_search(net_id):
for alloc in db_alloc: for alloc in db_alloc:
if alloc.is_dhcp: if alloc.is_dhcp:
obj_list.append(alloc) obj_list.append(alloc)
## GATEWAY
if 'gateway' in search:
for alloc in db_alloc:
if alloc.is_gateway:
obj_list.append(alloc)
else: else:
# BASIC SEARCH # BASIC SEARCH
for alloc in db_alloc: for alloc in db_alloc: