Пример #1
0
def ajax(t):
    if t == 'dataset':
        # Is sent a postcode... then figures out the suburb
        # Returns a template of dataset_table.html, which is then dynamically loaded
        postcode = request.form['postcode']
        suburb = fw.find_suburb(postcode)
        data = fw.fetch(suburb) # Should be result
        response = make_response(render_template('dataset_table.html', prices=data['results']))
        response.headers['X-Perthfuel-Suburb'] = data['using']
        return response
    abort(403)
Пример #2
0
def hello(postcode=None):
    
    # This should then launch the JS
    if postcode is None or len(str(postcode)) != 4:
        msg = "Default"
        return render_template('index.html', msg="Default")
        
    else:
        pc = postcode
        denyJS = True
        
        # Get all pricing information, format, and send to browser
        suburb = fw.find_suburb(pc)
        all = fw.fetch(suburb)
        
        return render_template('index.html', pc=postcode, denyJS=True, prices=all['results'], suburb_used=all['using'])
    return render_template('index.html')