10 changed files with 124 additions and 97 deletions
@ -0,0 +1,47 @@ |
|||||
|
import contentful |
||||
|
import markdown |
||||
|
import os |
||||
|
|
||||
|
class ContentfulService: |
||||
|
def __init__(self, space_id, access_token): |
||||
|
self.client = contentful.Client(space_id, access_token) |
||||
|
|
||||
|
def get_general_info(self): |
||||
|
entries = self.client.entries({'content_type': 'general'}) |
||||
|
if not entries: |
||||
|
return None |
||||
|
entry = entries[0] |
||||
|
general_date = entry.fields().get('general_date') |
||||
|
general_end_date = entry.fields().get('general_end_date') |
||||
|
general_text = entry.fields().get('general_text') |
||||
|
general_text_event = entry.fields().get('general_event_text') |
||||
|
general_text_conference = entry.fields().get('general_conference_text') |
||||
|
formatted_date = general_date.strftime('%#d %b %Y') if general_date else None |
||||
|
formatted_end_date = general_end_date.strftime('%#d %b %Y') if general_end_date else None |
||||
|
info = { |
||||
|
'startDate': formatted_date, |
||||
|
'endDate': formatted_end_date, |
||||
|
'text': markdown.markdown(general_text) if general_text else '', |
||||
|
'textConference': markdown.markdown(general_text_conference) if general_text_conference else '', |
||||
|
'textEvent':markdown.markdown(general_text_event) if general_text_event else '' |
||||
|
} |
||||
|
return info |
||||
|
|
||||
|
def get_location_info(self): |
||||
|
entries = self.client.entries({'content_type': 'locations'}) |
||||
|
location_list = [] |
||||
|
for e in entries: |
||||
|
name = getattr(e, 'name') |
||||
|
directions = getattr(e, 'directions') |
||||
|
url = getattr(e, 'url') |
||||
|
image_asset = getattr(e, 'image') |
||||
|
image_url = image_asset.url() if image_asset else '' |
||||
|
content = { |
||||
|
'name': name, |
||||
|
'directions' : directions, |
||||
|
'url' : url, |
||||
|
'image' : image_url |
||||
|
} |
||||
|
location_list.append(content) |
||||
|
return location_list |
||||
|
|
Binary file not shown.
@ -1,7 +1,9 @@ |
|||||
<div id="nav-bar"> |
<div id="nav-bar"> |
||||
<a href="/"><div class="nav-element">BETA FESTIVAL (2024)</div></a> |
<a href="/"><div class="nav-element">BETA FESTIVAL (2025)</div></a> |
||||
<div class="nav-element nav-element-align"> |
<div class="nav-element nav-element-align"> |
||||
<div>NOV 1 - 17 | DUBLIN</div> |
{% if festival_general_info %} |
||||
|
<div>{{ festival_general_info.startDate }} - {{ festival_general_info.endDate }} | DUBLIN</div> |
||||
|
{% endif %} |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
<hr> |
<hr> |
||||
|
@ -3,15 +3,15 @@ |
|||||
<head> |
<head> |
||||
<meta charset="UTF-8"> |
<meta charset="UTF-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
<meta name="og:description" content="The Beta Festival 2024 catalogue showcasing and archiving all exhibitions, events, and conferences which will be on as part of this years festival." /> |
<meta name="og:description" content="The Beta Festival 2025 catalogue showcasing and archiving all exhibitions, events, and conferences which will be on as part of this years festival." /> |
||||
<meta name="description" content="The Beta Festival 2024 catalogue showcasing and archiving all exhibitions, events, and conferences which will be on as part of this years festival." /> |
<meta name="description" content="The Beta Festival 2025 catalogue showcasing and archiving all exhibitions, events, and conferences which will be on as part of this years festival." /> |
||||
<meta content="Beta Festival 2024" property="og:title"/> |
<meta content="Beta Festival 2025" property="og:title"/> |
||||
<meta content="Beta Festival 2024" property="og:site_name"/> |
<meta content="Beta Festival 2025" property="og:site_name"/> |
||||
<meta content="website" property="og:type"/> |
<meta content="website" property="og:type"/> |
||||
<meta name="keywords" content="beta festival, 2024, dublin, art and technology, digital art" /> |
<meta name="keywords" content="beta festival, 2025, dublin, art and technology, digital art" /> |
||||
<meta name="robots" content="all" /> |
<meta name="robots" content="all" /> |
||||
<meta name="language" content="en-ie" /> |
<meta name="language" content="en-ie" /> |
||||
<title>Beta Festival 2024 {% block title %}{% endblock %}</title> |
<title>Beta Festival 2025 {% block title %}{% endblock %}</title> |
||||
<link rel="preconnect" href="https://fonts.googleapis.com"> |
<link rel="preconnect" href="https://fonts.googleapis.com"> |
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap" rel="stylesheet"> |
<link href="https://fonts.googleapis.com/css2?family=Inter:[email protected]&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap" rel="stylesheet"> |
||||
|
Loading…
Reference in new issue