Got submit button working
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from app import app
|
from app import app
|
||||||
from flask import render_template
|
from flask import render_template, request, redirect, url_for
|
||||||
from main import loadClients
|
from main import *
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@app.route('/index')
|
@app.route('/index')
|
||||||
@@ -10,4 +10,30 @@ def index():
|
|||||||
|
|
||||||
ClientName = loadClients()
|
ClientName = loadClients()
|
||||||
|
|
||||||
|
|
||||||
return render_template('index.html', title='SFU', ClientName=ClientName)
|
return render_template('index.html', title='SFU', ClientName=ClientName)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/runReport', methods=['GET', 'POST'])
|
||||||
|
def runReport():
|
||||||
|
|
||||||
|
ClientConfig = []
|
||||||
|
|
||||||
|
client = request.form['SelectedClient']
|
||||||
|
ClientConfig = GetClientConfig(client)
|
||||||
|
|
||||||
|
SF_URL = ClientConfig[0]
|
||||||
|
SF_HOST = ClientConfig[1]
|
||||||
|
REPORT_FIELDS = ClientConfig[2]
|
||||||
|
DETAIL_REPORT_FIELDS = ClientConfig[3]
|
||||||
|
summary_columnformat = ClientConfig[4]
|
||||||
|
headers = ClientConfig[5]
|
||||||
|
detail_columnformat = ClientConfig[6]
|
||||||
|
detail_headers = ClientConfig[7]
|
||||||
|
wb = ClientConfig[8]
|
||||||
|
ws = ClientConfig[9]
|
||||||
|
ws2 = ClientConfig[10]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return(str(client),SF_URL,SF_HOST,REPORT_FIELDS,DETAIL_REPORT_FIELDS,summary_columnformat,headers,detail_columnformat,detail_headers,wb, ws, ws2 )
|
||||||
|
|||||||
@@ -5,19 +5,17 @@
|
|||||||
<title>Title</title>
|
<title>Title</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% for x in ClientName %}
|
|
||||||
{{ ClientName[loop.index0] }} <br>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<select name = "SelectedClient">
|
<form method="post" action = "{{ url_for('runReport') }}" >
|
||||||
|
<select name = 'SelectedClient'>
|
||||||
{% for x in ClientName %}
|
{% for x in ClientName %}
|
||||||
<option value = "{{ SelectedClient }}" > {{ ClientName[loop.index0] }} </option>
|
<option value = {{ ClientName[loop.index0] }} > {{ ClientName[loop.index0] }} </option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<br>
|
<br>
|
||||||
<input type="submit">
|
<button type="submit">Submit</button>
|
||||||
<br><br>
|
</form>
|
||||||
{{ SelectedClient }}
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
4
main.py
4
main.py
@@ -307,8 +307,8 @@ def GetClientConfig(Client):
|
|||||||
for w in y.find_all('client'):
|
for w in y.find_all('client'):
|
||||||
for x in w.find_all('name'):
|
for x in w.find_all('name'):
|
||||||
if x.text == Client:
|
if x.text == Client:
|
||||||
SF_URL = x.find_all('storefrontapiurl').text
|
SF_URL = x.find('storefrontapiurl')
|
||||||
|
print("SF_URL" SF_URL)
|
||||||
# Get Storefront Host URL
|
# Get Storefront Host URL
|
||||||
temp1 = SF_URL.split('://')
|
temp1 = SF_URL.split('://')
|
||||||
temp2 = temp1[1].split('/')
|
temp2 = temp1[1].split('/')
|
||||||
|
|||||||
Reference in New Issue
Block a user