diff --git a/app/routes/r_base.py b/app/routes/r_base.py index 5bdcd14..1e05ec7 100644 --- a/app/routes/r_base.py +++ b/app/routes/r_base.py @@ -177,7 +177,10 @@ def allocation_edit_modal(net_id, ipv4): 'action_text': 'Save', '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 @base.get('/network//allocations//unallocate') @@ -187,6 +190,8 @@ def allocation_delete(net_id,ipv4): db_alloc.is_used = False db_alloc.hostname = None db_alloc.description = None + db_alloc.is_dhcp = False + db_alloc.is_gateway = False db.session.commit() flash("Allocation Deleted", 'warning') 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: if alloc.is_dhcp: obj_list.append(alloc) + + ## GATEWAY + if 'gateway' in search: + for alloc in db_alloc: + if alloc.is_gateway: + obj_list.append(alloc) else: # BASIC SEARCH for alloc in db_alloc: