From 55faab78d53f6e0cea7b0d1dc8ef651181895291 Mon Sep 17 00:00:00 2001
From: Pavel 'LEdoian' Turinsky <ledoian@matfyz.cz>
Date: Thu, 23 Apr 2020 00:57:21 +0200
Subject: [PATCH] =?UTF-8?q?Mergem=20jsem=20si=20p=C5=99it=C3=A1hl=20=C5=A1?=
 =?UTF-8?q?patnou=20verzi=20ProblemView,=20ma=C5=BEu.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 seminar/views/views_all.py | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py
index 38ec06f2..a91743c0 100644
--- a/seminar/views/views_all.py
+++ b/seminar/views/views_all.py
@@ -602,32 +602,6 @@ class RocnikView(generic.DetailView):
 
 		return context
 
-
-class ProblemView(generic.DetailView):
-	model = Problem
-
-	# Používáme funkci, protože přímo template_name neumí mít v přiřazení dost logiky. Ledaže by se to udělalo polymorfně...
-	def get_template_names(self, **kwargs):
-		# FIXME: Switch podle typu není hezký, ale nechtělo se mi to přepisovat celé. Správně by se tohle mělo řešit polymorfismem.
-		spravne_templaty = {
-				s.Uloha: "uloha",
-				s.Tema: "tema",
-				s.Konfera: "konfera",
-				s.Clanek: "clanek",
-				}
-		context = super().get_context_data(**kwargs)
-		return ['seminar/archiv/problem_' + spravne_templaty[context['object'].__class__]  + '.html']
-
-	def get_context_data(self, **kwargs):
-		context = super().get_context_data(**kwargs)
-		# Musí se používat context['object'], protože nevíme, jestli dostaneme úložku, téma, článek, .... a tyhle věci vyrábějí různé klíče.
-		if not context['object'].verejne() and not self.request.user.is_staff:
-			raise PermissionDenied()
-		if isinstance(context['object'], Clanek):
-			context['reseni'] = Reseni.objects.filter(problem=context['object']).select_related('resitel').order_by('resitel__prijmeni')
-		return context
-
-
 class RadekVysledkovkyCisla(object):
 	"""Obsahuje věci, které se hodí vědět při konstruování výsledkovky.
 	Umožňuje snazší práci v templatu (lepší, než seznam)."""