fix rule delete

This commit is contained in:
KF7EEL 2021-06-15 12:44:50 -07:00
parent 59ac3a693e
commit 5c73861c69
4 changed files with 15 additions and 11 deletions

BIN
HBNet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

4
db.txt
View File

@ -1,4 +0,0 @@
{
3153597:b'passw0rd',
1234567:b'password'
}

View File

@ -1995,12 +1995,15 @@ def create_app():
) )
db.session.add(add_system) db.session.add(add_system)
db.session.commit() db.session.commit()
def delete_system_bridge(_name, _server):
dr = BridgeRules.query.filter_by(server=_server).filter_by(bridge_name=_name).all()
for i in dr:
db.session.delete(i)
db.session.commit()
def delete_system_rule(_name, _server): def delete_system_rule(_name, _server, _system):
print(_name) dr = BridgeRules.query.filter_by(server=_server).filter_by(bridge_name=_name).filter_by(system_name=_system).first()
print(_server)
dr = BridgeRules.query.filter_by(server=_server).filter_by(bridge_name=_name).first()
db.session.delete(dr) db.session.delete(dr)
db.session.commit() db.session.commit()
@ -4301,7 +4304,12 @@ def create_app():
elif request.args.get('save_rule') == 'delete': elif request.args.get('save_rule') == 'delete':
print(request.args.get('bridge')) print(request.args.get('bridge'))
print(request.args.get('server')) print(request.args.get('server'))
delete_system_rule(request.args.get('bridge'), request.args.get('server')) if request.args.get('system'):
delete_system_rule(request.args.get('bridge'), request.args.get('server'), request.args.get('system'))
else:
delete_system_bridge(request.args.get('bridge'), request.args.get('server'))
## delete_system_rule(request.args.get('bridge'), request.args.get('server'), request.args.get('system'))
content = 'deleted' content = 'deleted'
elif request.args.get('add_rule'): elif request.args.get('add_rule'):
@ -4381,7 +4389,7 @@ def create_app():
<table style="margin-left: auto; margin-right: auto;" border="1"> <table style="margin-left: auto; margin-right: auto;" border="1">
<tbody> <tbody>
<tr> <tr>
<td>&nbsp;----</td> &nbsp;<td style="text-align: center;"><a href="manage_rules?save_rule=delete&server=''' + str(i.server) + '''&bridge=''' + str(i.bridge_name) + '''&system=''' + str(i.system_name) + '''">Delete SYSTEM Rule</a></td>
</tr> </tr>
<tr> <tr>
<td><form action="/cgi-bin/add_rule.py" method="post" > <td><form action="/cgi-bin/add_rule.py" method="post" >

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB