Browse Source

imma added & update api logic for general info

2025
Cailean Finn 5 days ago
parent
commit
2e9d3a3cac
  1. 19
      app.py
  2. 8
      templates/list-exhibitions.html

19
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/<ex_type>')
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')

8
templates/list-exhibitions.html

@ -22,6 +22,11 @@
Ethics Studio ↑
</div>
{% endif %}
{% if ex_type == "IMMA" %}
<div class="list-header">
IMMA Living Canvas x Beta ↑
</div>
{% endif %}
<div id="list-container" class="fadeInUp-animation">
@ -36,6 +41,9 @@
{% if ex_type == "ES"%}
<a href='/{{ title.lower() }}/ethics-studio/{{event.title}}'>
{% endif %}
{% if ex_type == "IMMA"%}
<a href='/{{ title.lower() }}/imma-living-canvas-x-beta/{{event.title}}'>
{% endif %}
<div class="list">
<div class="list-image">
<img src="{{ event.image }}" alt="{{event.title}}" loading="lazy">

Loading…
Cancel
Save