diff --git a/seminar/templates/seminar/archiv/prispevek.html b/seminar/templates/seminar/archiv/prispevek.html
new file mode 100644
index 00000000..5cf84f09
--- /dev/null
+++ b/seminar/templates/seminar/archiv/prispevek.html
@@ -0,0 +1,22 @@
+{% extends "seminar/archiv/base_temata.html" %}
+
+{% block title %}
+ {{prispevek.nazev}}
+{% endblock title %}
+
+{% block content %}
+ {% if not prispevek.zverejnit %}
{% endif %}
+
Příspěvek k tématu {{prispevek.problem.nazev}}
+ řešitele {{prispevek.reseni.resitel}}
+
+ {% if prispevek.text_org %}
+ Organizátorský komentář:
+ {% autoescape off %}{{prispevek.text_org}}{% endautoescape %}
+ {% endif %}
+
+ {% if prispevek.text_resitel %}
+ Text od Řešitele
+ {% autoescape off %}{{prispevek.text_resitel}}{% endautoescape %}
+ {% endif %}
+ {% if not prispevek.zverejnit %}
{% endif %}
+{% endblock content %}
diff --git a/seminar/urls.py b/seminar/urls.py
index 1e67073b..1be3dca5 100644
--- a/seminar/urls.py
+++ b/seminar/urls.py
@@ -16,6 +16,7 @@ urlpatterns = [
url(r'^rocnik/(?P\d+)/$', views.RocnikView.as_view(), name='seminar_rocnik'),
url(r'^cislo/(?P\d+)\.(?P[0-9-]+)/$', views.CisloView.as_view(), name='seminar_cislo'),
url(r'^problem/(?P\d+)/$', views.ProblemView.as_view(), name='seminar_problem'),
+ url(r'^problem/(?P\d+)/(?P\d+)/$', views.PrispevekView.as_view(), name='seminar_problem_prispevek'),
url(r'^soustredeni/probehlo/$', views.SoustredeniListView.as_view(),
name = 'seminar_seznam_soustredeni'),
diff --git a/seminar/views.py b/seminar/views.py
index 0d568cd2..9dc02c1d 100644
--- a/seminar/views.py
+++ b/seminar/views.py
@@ -11,7 +11,7 @@ from django.db.models import Q
from django.views.decorators.csrf import ensure_csrf_cookie
from django.contrib.auth import authenticate, login
-from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka
+from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Prispevek
from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
from . import utils
@@ -247,6 +247,32 @@ class ProblemView(generic.DetailView):
context['reseni'] = Reseni.objects.filter(problem=context['problem']).select_related('resitel').order_by('resitel__prijmeni')
return context
+class PrispevekView(generic.DetailView):
+ model = Prispevek
+ template_name = 'seminar/archiv/prispevek.html'
+
+ # Vlastni ziskavani objektu z databaze podle prispevku
+ # pokud je prispevek neverejny zobrazi se jenom orgum
+ def get_object(self, queryset=None):
+ if queryset is None:
+ queryset = self.get_queryset()
+ problem_arg = self.kwargs.get('pk')
+ prispevek_arg = self.kwargs.get('prispevek')
+ queryset = queryset.filter(pk=prispevek_arg)
+
+ print queryset
+
+ try:
+ obj = queryset.get()
+ except queryset.model.DoesNotExist:
+ raise Http404(_("No %(verbose_name)s found matching the query") %
+ {'verbose_name': queryset.model._meta.verbose_name})
+
+ if self.request.user.is_staff or obj.zverejnit:
+ return obj
+ else:
+ raise Http404()
+
class RadekVysledkovky(object):