Browse Source

app fixed for ex types

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

17
templates/list-exhibitions.html

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

Loading…
Cancel
Save