fix: use HTML meta refresh redirect instead of DataViewer or 302
PopupWindow renders dspy response directly. DataViewer doesn't work inside popup context. HTML meta refresh redirects to CRUD page.
This commit is contained in:
parent
a930847317
commit
1e7f713725
@ -1,11 +1,11 @@
|
||||
"""Check/create distribution_agreement for sub_reseller_id, then redirect to CRUD page."""
|
||||
sub_reseller_id = params_kw.get('sub_reseller_id')
|
||||
if not sub_reseller_id:
|
||||
return {'widgettype': 'Error', 'options': {'title': 'Error', 'message': 'Missing sub_reseller_id', 'timeout': 3}}
|
||||
return '<h3>Error: Missing sub_reseller_id</h3>'
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {'widgettype': 'Error', 'options': {'title': 'Auth Error', 'message': 'Please login', 'timeout': 3}}
|
||||
return '<h3>Error: Please login</h3>'
|
||||
|
||||
dbname = get_module_dbname('supplychain')
|
||||
async with DBPools().sqlorContext(dbname) as sor:
|
||||
@ -33,7 +33,5 @@ async with DBPools().sqlorContext(dbname) as sor:
|
||||
'created_by': userorgid, 'created_at': now, 'updated_at': now,
|
||||
})
|
||||
|
||||
# Redirect to CRUD page
|
||||
request._response_status = 302
|
||||
request._response_headers['Location'] = f'/supplychain/distribution_agreements_list?sub_reseller_id={sub_reseller_id}&_webbricks_=1'
|
||||
return ''
|
||||
url = f'/supplychain/distribution_agreements_list?sub_reseller_id={sub_reseller_id}&_webbricks_=1'
|
||||
return f'<html><head><meta http-equiv="refresh" content="0;url={url}"></head><body>Redirecting...</body></html>'
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
"""Check/create supply_contract for supplier_id, then redirect to CRUD page."""
|
||||
supplier_id = params_kw.get('supplier_id')
|
||||
if not supplier_id:
|
||||
return {'widgettype': 'Error', 'options': {'title': 'Error', 'message': 'Missing supplier_id', 'timeout': 3}}
|
||||
return '<h3>Error: Missing supplier_id</h3>'
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {'widgettype': 'Error', 'options': {'title': 'Auth Error', 'message': 'Please login', 'timeout': 3}}
|
||||
return '<h3>Error: Please login</h3>'
|
||||
|
||||
dbname = get_module_dbname('supplychain')
|
||||
async with DBPools().sqlorContext(dbname) as sor:
|
||||
@ -33,7 +33,5 @@ async with DBPools().sqlorContext(dbname) as sor:
|
||||
'created_by': userorgid, 'created_at': now, 'updated_at': now,
|
||||
})
|
||||
|
||||
# Redirect to CRUD page
|
||||
request._response_status = 302
|
||||
request._response_headers['Location'] = f'/supplychain/supply_contracts_list?supplier_id={supplier_id}&_webbricks_=1'
|
||||
return ''
|
||||
url = f'/supplychain/supply_contracts_list?supplier_id={supplier_id}&_webbricks_=1'
|
||||
return f'<html><head><meta http-equiv="refresh" content="0;url={url}"></head><body>Redirecting...</body></html>'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user