Switch to random image as start page.

This commit is contained in:
Edward Betts 2019-09-27 14:13:28 +01:00
parent 3efeedb7ba
commit d7df704327
4 changed files with 14 additions and 6 deletions

12
app.py
View file

@ -119,9 +119,9 @@ def set_url_args(**new_args):
def init_profile():
g.profiling = []
@app.route("/")
def index():
return render_template('index.html',
@app.route("/browse")
def browse_index():
return render_template('browse_index.html',
props=find_more_props,
username=get_username())
@ -163,7 +163,11 @@ def property_query_page(property_id):
pid=pid,
rows=rows)
@app.route('/random')
@app.route('/')
def start():
return random_painting()
@app.route('/next')
def random_painting():
rows = wdqs.run_query_with_cache(painting_no_depicts_query)
row = random.choice(rows)

View file

@ -11,7 +11,9 @@
{% endif %}
</p>
{% if username %}
<p>username: {{ username }}</p>
{% endif %}
{% if not username %}
<p>This tool must be connected with Wikidata to work.</p>

View file

@ -17,7 +17,9 @@
<p>
<a href="https://www.wikidata.org/wiki/{{ qid }}">view this painting on Wikidata</a>
|
<a href="{{ url_for('random_painting') }}">open a random painting</a>
<a href="{{ url_for('random_painting') }}">switch to another painting</a>
|
<a href="{{ url_for('browse_index') }}">browse paintings</a>
</p>

View file

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