Skip to content

Commit c6a2775

Browse files
author
Bojan Jovanovic
committed
Merge branch 'master' of github.com:PythonBalkan/pyconbalkan
2 parents 9d4a978 + 9881648 commit c6a2775

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

932 Bytes
Binary file not shown.

pyconbalkan/core/templates/includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</li>
2323
<li class="menu__list__item">
2424
{% if conference.timetable_pdf %}
25-
<a class="menu__list__link {% if request.path == conference.timetable_pdf.url %}active{% endif %}" href="{{ conference.timetable_pdf.url }}" role="button">Timetable</a>
25+
<a class="menu__list__link {% if request.path == '/timetable_pdf' %}active{% endif %}" href="/timetable_pdf" role="button">Timetable</a>
2626
{% else %}
2727
<a class="menu__list__link {% if request.path == '/timetable' %}active{% endif %}" href="{% url 'timetable' %}" role="button">Timetable</a>
2828
{% endif %}

pyconbalkan/timetable/views.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

2-
from django.shortcuts import render
2+
from django.shortcuts import render, redirect
33
from rest_framework import viewsets
44

5+
from pyconbalkan.conference.models import Conference
56
from pyconbalkan.timetable.models import Room, Slot, Timetable
67
from pyconbalkan.timetable.serializers import TimetableSerializer
78

@@ -11,6 +12,13 @@ class TimetableViewSet(viewsets.ModelViewSet):
1112
serializer_class = TimetableSerializer
1213

1314

15+
def timetable_pdf_view(request):
16+
conference = Conference.objects.filter(active=True)
17+
if conference and conference.first().timetable_pdf:
18+
return redirect(conference.first().timetable_pdf.url)
19+
return redirect('/')
20+
21+
1422
def timetable_view(request):
1523
slots_by_rooms = {}
1624
rooms = Room.objects.all()

pyconbalkan/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from pyconbalkan.speaker.views import *
2727
from pyconbalkan.sponsors.api_urls import router as sponsors
2828

29-
from pyconbalkan.timetable.views import timetable_view
29+
from pyconbalkan.timetable.views import timetable_view, timetable_pdf_view
3030
from pyconbalkan.faq.views import faq_view
3131
from pyconbalkan.faq.api_urls import router as faq
3232
from pyconbalkan.sponsors.views import sponsor_view, sponsoring_view, sponsors_view
@@ -68,9 +68,9 @@
6868
path('admin/', admin.site.urls),
6969
path('api/', include(router.urls)), # API
7070
path('markdownx/', include(markdownx)),
71+
path('timetable_pdf/', timetable_pdf_view, name='timetable_pdf'),
7172
path('timetable/', timetable_view, name='timetable'),
7273
path('faq', faq_view, name='faq'),
73-
path('timetable/', serve, {'path': 'pycon-balkan-2018-timetable.pdf', 'document_root': PDF_ROOT}, name='timetable'),
7474
]
7575

7676
# Add Django site authentication urls (for login, logout, password management)

0 commit comments

Comments
 (0)