calendar and small layout fix

This commit is contained in:
2020-12-11 22:20:51 +00:00
parent 8135d87f71
commit 12fc63dc60
5 changed files with 42 additions and 3 deletions

View File

@@ -7,5 +7,6 @@ urlpatterns = [
path('func/slug_calc', views.slug_calc),
path('t/<str:tag>', views.tags, name='posts.tags'),
path('', views.index, name='posts.index'),
path('fet_calendar.ics', views.calendar, name='posts.calendar'),
path('<str:id>', views.show, name='posts.show'),
]

View File

@@ -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))

View File

@@ -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}} <a href="https://alpha.2020.fet.at/{{event.url}}">{{even.title}}</a>
CLASS:PUBLIC
DTSTART;TZID=Europe/Vienna:20200306T120000
DTEND;TZID=Europe/Vienna:20200306T140000
DTSTAMP;TZID=Europe/Vienna:20200306T120000
END:VEVENT
{% endfor %}
END:VCALENDAR

View File

@@ -1,7 +1,7 @@
<a href="{% url 'posts.show' post.slug %}">
<div class="news-hero padding-bottom-1" style="background-image:url('{{ post.imageurl }}')">
<div class="news-hero-text">
<h1>{{ post.title }}</h1>
<h1>{{ post.title | safe }}</h1>
<h2>{{ post.subtitle|default_if_none:"&nbsp;" }}</h2>
{{ post }}
</div>

View File

@@ -20,12 +20,13 @@
</div>
<div class="article-title">
<h1>{{ post.title|tags_to_url }}</h1>
<h1>{{ post.title|tags_to_url }}</h1>
</div>
<div class="article-details">
<div>
{{ post.subtitle|default_if_none:"&nbsp;"|tags_to_url }}
</div>
{% if post.author %}
<div class="article-author"><a href="{% url 'member' post.author %}">
<img src="{{ author_image }}" alt="" /> {{ post.author }}