Fix browse index.

This commit is contained in:
Edward Betts 2019-09-27 15:35:26 +01:00
parent f7f29ad1fb
commit 8fa23e5e19
3 changed files with 7 additions and 8 deletions

11
app.py
View file

@ -119,12 +119,6 @@ def set_url_args(**new_args):
def init_profile(): def init_profile():
g.profiling = [] g.profiling = []
@app.route("/browse")
def browse_index():
return render_template('browse_index.html',
props=find_more_props,
username=get_username())
@app.route("/property/P<int:property_id>") @app.route("/property/P<int:property_id>")
def property_query_page(property_id): def property_query_page(property_id):
pid = f'P{property_id}' pid = f'P{property_id}'
@ -455,6 +449,11 @@ def browse_page():
params = [(pid, qid) for pid, qid in request.args.items() params = [(pid, qid) for pid, qid in request.args.items()
if pid.startswith('P') and qid.startswith('Q')] if pid.startswith('P') and qid.startswith('Q')]
if not params:
return render_template('browse_index.html',
props=find_more_props,
username=get_username())
flat = '_'.join(f'{pid}={qid}' for pid, qid in params) flat = '_'.join(f'{pid}={qid}' for pid, qid in params)
# item_entity = get_entity_with_cache(qid) # item_entity = get_entity_with_cache(qid)

View file

@ -19,7 +19,7 @@
| |
<a href="{{ url_for('random_painting') }}">switch to another painting</a> <a href="{{ url_for('random_painting') }}">switch to another painting</a>
| |
<a href="{{ url_for('browse_index') }}">browse paintings</a> <a href="{{ url_for('browse_page') }}">browse paintings</a>
</p> </p>

View file

@ -6,7 +6,7 @@
<div class="m-3"> <div class="m-3">
<h1>{{ self.title() }}</h1> <h1>{{ self.title() }}</h1>
<p><a href="{{ url_for('browse_index') }}">back to index</a></p> <p><a href="{{ url_for('browse_page') }}">back to index</a></p>
<p>Sort order: <p>Sort order:
{% if order == 'name' %} {% if order == 'name' %}