Browse Source

app fixed for ex types

graphics
Cailean Finn 3 weeks ago
parent
commit
a37bf54d10
  1. 21
      app.py
  2. 17
      templates/list-exhibitions.html

21
app.py

@ -28,14 +28,14 @@ def events():
def exhibitions():
return render_template('list.html', title='Exhibitions')
@app.route('/exhibitions/<type>')
def exhibition_type(type):
if type == "local-artists-network":
type = "LAN"
elif type == "unsettling-the-algorithm":
type = "UTA"
@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":
ex_type = "UTA"
exhibitions = get_all_content('exhibition')
return render_template('list-exhibitions.html', title="Exhibitions", content=exhibitions, type=type)
return render_template('list-exhibitions.html', title="Exhibitions", content=exhibitions, ex_type=ex_type)
@app.route('/conferences')
def conference():
@ -47,6 +47,11 @@ def event_article(type, title):
data = get_content_by_title(title, type)
return render_template('article.html', title=title, content=data)
@app.route('/<type>/<ex_type>/<title>')
def event_articles(type, title, ex_type):
data = get_content_by_title(title, type)
return render_template('article.html', title=title, content=data)
@app.route('/locations')
def locations():
return render_template('locations.html', title='Locations')
@ -58,6 +63,7 @@ def get_all_content(type):
def get_content_by_title(title, pre_type):
type = pre_type[:-1]
print(type)
entries = client.entries({'query': title, 'limit': 5})
exact_matches = [entry for entry in entries if getattr(entry, f'title_of_{type}') == title]
content_list = process_content(exact_matches, type)
@ -108,7 +114,6 @@ def process_content(entries, type):
'bookUrl': bookUrl,
'exh_type': exh_type
}
content_list.append(content)
# Sort the content list by the 'title' key alphabetically

17
templates/list-exhibitions.html

@ -7,22 +7,27 @@
{% include '_nav.html' %}
{% include '_list-header.html'%}
<div id="main-container">
{% if type == "UTA" %}
{% if ex_type == "UTA" %}
<div class="list-header">
Unsettling the Algorithm
Unsettling the Algorithm
</div>
{% endif %}
{% if type == "LAN" %}
{% if ex_type == "LAN" %}
<div class="list-header">
Local Artists Network
Local Artists Network
</div>
{% endif %}
<div id="list-container" class="fadeInUp-animation">
{% for event in content %}
{% if event.exh_type == type %}
<a href='/{{ title.lower() }}/{{ event.title }}'>
{% if event.exh_type == ex_type %}
{% if ex_type == "UTA"%}
<a href='/{{ title.lower() }}/unsettling-the-algorithm/{{ event.title }}'>
{% endif %}
{% if ex_type == "LAN"%}
<a href='/{{ title.lower() }}/local-artists-network/{{ event.title }}'>
{% endif %}
<div class="list">
<div class="list-image">
<img src="{{ event.image }}" alt="{{ event.title }}" loading="lazy">

Loading…
Cancel
Save