Commit 0ebeb903 authored by Luuk Scholten's avatar Luuk Scholten Committed by Sébastiaan Versteeg

Implement simple deprecated ical feed

Always has events for the next week, starting at 13:37
parent 96e6d33f
from datetime import datetime, timedelta
from django.urls import reverse
from django.utils.translation import activate
from django_ical.views import ICalFeed
......@@ -40,3 +42,30 @@ class EventFeed(ICalFeed):
def item_location(self, item):
return "{} - {}".format(item.location, item.map_location)
class DeprecationFeed(ICalFeed):
def product_id(self):
return '-//thalia.nu//DEPRECATED'
def items(self):
return range(7)
def item_start_datetime(self, item):
today = datetime.now().replace(hour=13, minute=37, second=0)
delta = timedelta(days=item)
return today + delta
def item_end_datetime(self, item):
today = datetime.now().replace(hour=15, minute=37, second=0)
delta = timedelta(days=item)
return today + delta
def item_title(self, item):
return (
'Oude Thalia Feed, gebruik https://thalia.nu/' +
reverse('events:ical-nl')
)
def item_link(self, item):
return reverse('events:ical-nl') + '?item={}'.format(item)
......@@ -23,6 +23,7 @@ from django.contrib.sitemaps.views import sitemap
from django.views.generic import TemplateView
from django.views.i18n import JavaScriptCatalog
from events.feeds import DeprecationFeed
from utils.views import private_thumbnails
import members
......@@ -49,6 +50,7 @@ urlpatterns = [
url(r'^members/', include('members.urls', namespace='members')),
url(r'^nyi$', TemplateView.as_view(template_name='status/nyi.html'), name='#'),
url(r'^events/', include('events.urls', namespace='events')),
url(r'^index\.php/events/ical/feed\.ics', DeprecationFeed()),
url(r'^newsletters/', include('newsletters.urls',
namespace='newsletters')),
url(r'^association$', TemplateView.as_view(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment