diff --git a/fet2020/posts/urls.py b/fet2020/posts/urls.py index db5dac31..d0204e37 100644 --- a/fet2020/posts/urls.py +++ b/fet2020/posts/urls.py @@ -7,5 +7,6 @@ urlpatterns = [ path('func/slug_calc', views.slug_calc), path('t/', views.tags, name='posts.tags'), path('', views.index, name='posts.index'), + path('fet_calendar.ics', views.calendar, name='posts.calendar'), path('', views.show, name='posts.show'), ] diff --git a/fet2020/posts/views.py b/fet2020/posts/views.py index eb5b7aba..58e9de42 100644 --- a/fet2020/posts/views.py +++ b/fet2020/posts/views.py @@ -32,6 +32,9 @@ def index(request): return render(request, 'posts/index.html', {"posts": posts, "tags_list": t}) +def calendar(request): + events=deque(Post.objects.get_visible_articles().order_by('-public_date')) + return render(request, 'posts/fet_calendar.ics', {"events": events}) def tags(request, tag=""): posts = deque(Post.objects.get_visible_articles().filter(tags__name=tag)) diff --git a/fet2020/templates/posts/fet_calendar.ics b/fet2020/templates/posts/fet_calendar.ics new file mode 100644 index 00000000..e80e065d --- /dev/null +++ b/fet2020/templates/posts/fet_calendar.ics @@ -0,0 +1,34 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:http://www.fet.at/ +METHOD:PUBLISH +X-WR-TIMEZONE:Europe/Vienna +BEGIN:VTIMEZONE +TZID:Europe/Vienna +BEGIN:DAYLIGHT +TZOFFSETFROM:+0100 +DTSTART:19810329T020000 +RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU +TZNAME:MESZ +END:DAYLIGHT +BEGIN:STANDARD +TZOFFSETFROM:+0200 +DTSTART:19961027T030000 +RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU +TZNAME:MEZ +END:STANDARD +END:VTIMEZONE +{% for event in events %} +BEGIN:VEVENT +UID:4610745 +ORGANIZER;CN="Fachschaft Elektrotechnik, Example Inc.":MAILTO:service@fet.at +LOCATION:Vienna +SUMMARY:{{ event.title }} +DESCRIPTION: {{event.url}} https://alpha.2020.fet.at/{{event.url}} {{even.title}} +CLASS:PUBLIC +DTSTART;TZID=Europe/Vienna:20200306T120000 +DTEND;TZID=Europe/Vienna:20200306T140000 +DTSTAMP;TZID=Europe/Vienna:20200306T120000 +END:VEVENT +{% endfor %} +END:VCALENDAR \ No newline at end of file diff --git a/fet2020/templates/posts/partials/_posts_hero.html b/fet2020/templates/posts/partials/_posts_hero.html index 54e98043..42916668 100644 --- a/fet2020/templates/posts/partials/_posts_hero.html +++ b/fet2020/templates/posts/partials/_posts_hero.html @@ -1,7 +1,7 @@
-

{{ post.title }}

+

{{ post.title | safe }}

{{ post.subtitle|default_if_none:" " }}

{{ post }}
diff --git a/fet2020/templates/posts/show.html b/fet2020/templates/posts/show.html index 4c7bf96b..47a83aba 100644 --- a/fet2020/templates/posts/show.html +++ b/fet2020/templates/posts/show.html @@ -20,12 +20,13 @@
-

{{ post.title|tags_to_url }}

+

{{ post.title|tags_to_url }}

+
{{ post.subtitle|default_if_none:" "|tags_to_url }} - +
{% if post.author %}