|
|
@ -29,7 +29,7 @@ def inject_general_info(): |
|
|
|
|
|
|
|
@app.route('/') |
|
|
|
def index(): |
|
|
|
sup_img, prio_img, prio_img_top = get_support_images() |
|
|
|
sup_img, prio_img, prio_img_top = contentful_service.get_sponser_logos() |
|
|
|
return render_template('index.html', title='', sup_img_list=sup_img, prio_img=prio_img, prio_img_top=prio_img_top) |
|
|
|
|
|
|
|
@app.route('/grph') |
|
|
@ -43,7 +43,9 @@ def events(): |
|
|
|
|
|
|
|
@app.route('/exhibitions') |
|
|
|
def exhibitions(): |
|
|
|
return render_template('list.html', title='Exhibitions') |
|
|
|
exhibition_info = contentful_service.get_exhibition_list_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): |
|
|
@ -53,6 +55,8 @@ def exhibition_type(ex_type): |
|
|
|
ex_type = "UTA" |
|
|
|
elif ex_type == "ethics-studio": |
|
|
|
ex_type = "ES" |
|
|
|
elif ex_type == "starts4waterii": |
|
|
|
ex_type = "S4W2" |
|
|
|
exhibitions = get_all_content('exhibition') |
|
|
|
return render_template('list-exhibitions.html', title="Exhibitions", content=exhibitions, ex_type=ex_type) |
|
|
|
|
|
|
@ -148,33 +152,7 @@ def process_content(entries, type): |
|
|
|
# Sort the content list by the 'title' key alphabetically |
|
|
|
content_list.sort(key=lambda x: x['title'].lower()) |
|
|
|
|
|
|
|
return content_list |
|
|
|
|
|
|
|
def get_support_images(): |
|
|
|
# Specify the folder where images are stored |
|
|
|
image_folder = os.path.join(app.static_folder, 'images/support') |
|
|
|
|
|
|
|
# Define a list of supported image file extensions |
|
|
|
valid_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp'] |
|
|
|
|
|
|
|
# List to hold the image file names |
|
|
|
image_files = [] |
|
|
|
prio_image_files = [] |
|
|
|
prio_image_top_files = [] |
|
|
|
|
|
|
|
# Loop through files in the directory |
|
|
|
for filename in os.listdir(image_folder): |
|
|
|
# Check if the file is an image (by extension) |
|
|
|
if os.path.splitext(filename)[1].lower() in valid_extensions: |
|
|
|
if os.path.splitext(filename)[0].lower() == "dg" or os.path.splitext(filename)[0].lower() == "sw": |
|
|
|
prio_image_top_files.append(filename) |
|
|
|
elif os.path.splitext(filename)[0].lower() == "french-emb" or os.path.splitext(filename)[0].lower() == "nn" or os.path.splitext(filename)[0].lower() == "if": |
|
|
|
prio_image_files.append(filename) |
|
|
|
else: |
|
|
|
image_files.append(filename) |
|
|
|
|
|
|
|
return image_files, prio_image_files, prio_image_top_files |
|
|
|
|
|
|
|
return content_list |
|
|
|
|
|
|
|
def format_datetime(dt): |
|
|
|
date_str = dt.strftime('%d.%m.%y') |
|
|
|