From d7df704327d45e445a0d89b4927de1b459eca844 Mon Sep 17 00:00:00 2001
From: Edward Betts
Date: Fri, 27 Sep 2019 14:13:28 +0100
Subject: [PATCH] Switch to random image as start page.
---
app.py | 12 ++++++++----
templates/{index.html => browse_index.html} | 2 ++
templates/item.html | 4 +++-
templates/property.html | 2 +-
4 files changed, 14 insertions(+), 6 deletions(-)
rename templates/{index.html => browse_index.html} (95%)
diff --git a/app.py b/app.py
index 6bdf9f8..3edfb3c 100755
--- a/app.py
+++ b/app.py
@@ -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)
diff --git a/templates/index.html b/templates/browse_index.html
similarity index 95%
rename from templates/index.html
rename to templates/browse_index.html
index ad55ff8..b30996d 100644
--- a/templates/index.html
+++ b/templates/browse_index.html
@@ -11,7 +11,9 @@
{% endif %}
+ {% if username %}
username: {{ username }}
+ {% endif %}
{% if not username %}
This tool must be connected with Wikidata to work.
diff --git a/templates/item.html b/templates/item.html
index 1cc24bc..37d9cec 100644
--- a/templates/item.html
+++ b/templates/item.html
@@ -17,7 +17,9 @@
view this painting on Wikidata
|
- open a random painting
+ switch to another painting
+ |
+ browse paintings
diff --git a/templates/property.html b/templates/property.html
index b3df277..d984c93 100644
--- a/templates/property.html
+++ b/templates/property.html
@@ -6,7 +6,7 @@