Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
|
de882d968c | 10 hours ago |
|
5bb0305d82 | 10 hours ago |
|
762ae1c08b | 4 days ago |
|
e88fe4d66f | 5 days ago |
|
2e9d3a3cac | 5 days ago |
|
bf27c7c87b | 2 weeks ago |
|
d5ad2c4876 | 2 weeks ago |
|
ce9c22d0b1 | 2 weeks ago |
|
11af659bb4 | 4 weeks ago |
13 changed files with 271 additions and 175 deletions
@ -0,0 +1,104 @@ |
|||
import contentful |
|||
import markdown |
|||
import os |
|||
import re |
|||
|
|||
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 |
|||
|
|||
def get_exhibition_list_info(self): |
|||
entries = self.client.entries({'content_type': 'exhibitionList'}) |
|||
exhibition_list = [] |
|||
for e in entries: |
|||
title = getattr(e, 'title') |
|||
|
|||
description = getattr(e, 'description') |
|||
description = markdown.markdown(description) |
|||
|
|||
start_date = getattr(e, 'start_date') |
|||
start_date = start_date.strftime('%#d %b %Y') if start_date else None |
|||
|
|||
end_date = getattr(e, 'end_date') |
|||
end_date = end_date.strftime('%#d %b %Y') if end_date else None |
|||
|
|||
location = getattr(e, 'location') |
|||
|
|||
slug = title.lower() # Convert to lowercase |
|||
slug = re.sub(r'[^a-z0-9\s-]', '', slug) # Remove non-alphanumeric characters |
|||
slug = re.sub(r'[\s-]+', '-', slug).strip('-') # Replace spaces and repeated hyphens |
|||
url = slug |
|||
|
|||
content = { |
|||
'title': title, |
|||
'location': location, |
|||
'description': description, |
|||
'start_date': start_date, |
|||
'end_date': end_date, |
|||
'url': url |
|||
} |
|||
|
|||
exhibition_list.append(content) |
|||
return exhibition_list |
|||
|
|||
def get_sponser_logos(self): |
|||
entries = self.client.entries({'content_type': 'sponser'}) |
|||
supp_img = [] |
|||
prio_img = [] |
|||
top_img = [] |
|||
for e in entries: |
|||
src = getattr(e, 'logo') |
|||
idx = getattr(e, 'type') |
|||
|
|||
content = 'https:{0}'.format(src.url()) |
|||
|
|||
|
|||
if idx == '1': |
|||
top_img.append(content) |
|||
elif idx == '2': |
|||
prio_img.append(content) |
|||
else: |
|||
supp_img.append(content) |
|||
|
|||
|
|||
return supp_img, prio_img, top_img |
|||
|
Binary file not shown.
@ -1,7 +1,9 @@ |
|||
<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>NOV 1 - 17 | DUBLIN</div> |
|||
{% if festival_general_info %} |
|||
<div>{{ festival_general_info.startDate }} - {{ festival_general_info.endDate }} | DUBLIN</div> |
|||
{% endif %} |
|||
</div> |
|||
</div> |
|||
<hr> |
|||
|
@ -3,15 +3,15 @@ |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<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="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 content="Beta Festival 2024" property="og:title"/> |
|||
<meta content="Beta Festival 2024" property="og:site_name"/> |
|||
<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 2025 catalogue showcasing and archiving all exhibitions, events, and conferences which will be on as part of this years festival." /> |
|||
<meta content="Beta Festival 2025" property="og:title"/> |
|||
<meta content="Beta Festival 2025" property="og:site_name"/> |
|||
<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="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.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"> |
|||
|
Loading…
Reference in new issue