|
|
@ -31,10 +31,41 @@ def exhibitions(): |
|
|
|
def conference(): |
|
|
|
return render_template('list.html', title='Conferences') |
|
|
|
|
|
|
|
@app.route('/<type>/<title>') |
|
|
|
def event_article(type, title): |
|
|
|
data = get_content_by_title(title, type) |
|
|
|
print(data) |
|
|
|
return render_template('article.html', title=title) |
|
|
|
|
|
|
|
|
|
|
|
def get_all_content(type): |
|
|
|
content_list = [] |
|
|
|
entries = client.entries({'content_type': type}) |
|
|
|
for entry in entries: |
|
|
|
|
|
|
|
date_time_obj = getattr(entry, f'{type}_date_time') |
|
|
|
date_str, time_str = format_datetime(date_time_obj) |
|
|
|
end_time_str = getattr(entry, f'{type}_end_date_time') |
|
|
|
end_time_str = end_time_str.strftime('%I%p').upper().lstrip('0') |
|
|
|
content = { |
|
|
|
'title': getattr(entry, f'title_of_{type}'), |
|
|
|
'information': getattr(entry, f'{type}_information'), |
|
|
|
'image': 'https:{0}'.format(getattr(entry, f'{type}_reference_image').url()), |
|
|
|
'artists': getattr(entry, f'{type}_artists'), |
|
|
|
'date': date_str, |
|
|
|
'time': time_str, |
|
|
|
'end_time': end_time_str, |
|
|
|
'location': getattr(entry, f'{type}_location') |
|
|
|
} |
|
|
|
content_list.append(content) |
|
|
|
return content_list |
|
|
|
|
|
|
|
def get_content_by_title(title, pre_type): |
|
|
|
content_list = [] |
|
|
|
type = pre_type[:-1] |
|
|
|
entries = client.entries({'query': title, 'limit': 1}) |
|
|
|
for entry in entries: |
|
|
|
|
|
|
|
date_time_obj = getattr(entry, f'{type}_date_time') |
|
|
|
date_str, time_str = format_datetime(date_time_obj) |
|
|
|
end_time_str = getattr(entry, f'{type}_end_date_time') |
|
|
@ -50,7 +81,6 @@ def get_all_content(type): |
|
|
|
'location': getattr(entry, f'{type}_location') |
|
|
|
} |
|
|
|
content_list.append(content) |
|
|
|
print(content_list) |
|
|
|
return content_list |
|
|
|
|
|
|
|
def format_datetime(dt): |
|
|
|