diff --git a/app.py b/app.py index e48c3a2..439e5f8 100644 --- a/app.py +++ b/app.py @@ -16,16 +16,12 @@ ACCESS_TOKEN = os.getenv('ACCESS_TOKEN') client = contentful.Client(SPACE_ID, ACCESS_TOKEN) contentful_service = ContentfulService(SPACE_ID, ACCESS_TOKEN) -# Simple in-memory cahce - this is to store information that will be used on all pages, so I don't have to make -# request's over and over again. -global festival_general_info_cache - -with app.app_context(): - festival_general_info_cache = contentful_service.get_general_info() - @app.context_processor def inject_general_info(): - return dict(festival_general_info=festival_general_info_cache) + # Fetch the data here, inside the function that runs for every request. + # This guarantees the data is always fresh from Contentful. + festival_info = contentful_service.get_general_info() + return dict(festival_general_info=festival_info) @app.route('/') def index(): @@ -44,11 +40,12 @@ def events(): @app.route('/exhibitions') def exhibitions(): exhibition_info = contentful_service.get_exhibition_list_info() - print(exhibition_info) + #print(exhibition_info) return render_template('list.html', title='Exhibitions', exhibition_info=exhibition_info) @app.route('/exhibitions/') def exhibition_type(ex_type): + if ex_type == "local-artists-network": ex_type = "LAN" elif ex_type == "unsettling-the-algorithm": @@ -57,7 +54,11 @@ def exhibition_type(ex_type): ex_type = "ES" elif ex_type == "starts4waterii": ex_type = "S4W2" + elif ex_type == "imma-living-canvas-x-beta": + ex_type = "IMMA" + exhibitions = get_all_content('exhibition') + print(ex_type) return render_template('list-exhibitions.html', title="Exhibitions", content=exhibitions, ex_type=ex_type) @app.route('/conferences') diff --git a/templates/list-exhibitions.html b/templates/list-exhibitions.html index 6838803..823ae5b 100644 --- a/templates/list-exhibitions.html +++ b/templates/list-exhibitions.html @@ -22,6 +22,11 @@ Ethics Studio ↑ {% endif %} + {% if ex_type == "IMMA" %} +
+ IMMA Living Canvas x Beta ↑ +
+ {% endif %}
@@ -36,6 +41,9 @@ {% if ex_type == "ES"%} {% endif %} + {% if ex_type == "IMMA"%} + + {% endif %}
{{event.title}}