From e42faa4ce8afc18bf1bd23309afdb5e5c587872e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 22 Nov 2021 20:53:50 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=C5=98e=C5=A1itelsk=C3=BD=20p=C5=99ehled,?= =?UTF-8?q?=20odkaz=20na=20datu=20(m=C3=ADsto=20na=20bodech)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odevzdavatko/templates/odevzdavatko/prehled_reseni.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odevzdavatko/templates/odevzdavatko/prehled_reseni.html b/odevzdavatko/templates/odevzdavatko/prehled_reseni.html index 773aa2a3..ae3d45a9 100644 --- a/odevzdavatko/templates/odevzdavatko/prehled_reseni.html +++ b/odevzdavatko/templates/odevzdavatko/prehled_reseni.html @@ -23,9 +23,9 @@ {% for hodn in hodnoceni %} - {{ hodn.reseni.cas_doruceni | date:"d.m.Y H:i"}} + {{ hodn.reseni.cas_doruceni | date:"d.m.Y H:i"}} {{ hodn.problem.nazev | zkrat_nazev_problemu }} - {{ hodn.body|default_if_none:"---" }} + {{ hodn.body|default_if_none:"---" }} {{ hodn.reseni.cas_doruceni | deadline_html }} {% endfor %} From 1012f9b3c53d7cb07717860ecdd7ec3e8f57aee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 22 Nov 2021 21:12:56 +0100 Subject: [PATCH 2/5] =?UTF-8?q?Remove=20zapomenut=C3=A1=20t=C5=99=C3=ADda?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/views/views_all.py | 138 ------------------------------------- 1 file changed, 138 deletions(-) diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 09260392..04a27814 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -68,144 +68,6 @@ class ObalkovaniView(generic.ListView): context['cislo'] = self.cislo return context -class TNLData(object): - def __init__(self,anode,parent=None, index=None): - self.node = anode - self.sernode = vr.TreeNodeSerializer(anode) - self.children = [] - self.parent = parent - self.tema_in_path = False - self.index = index - - if parent: - self.tema_in_path = parent.tema_in_path - if isinstance(anode, m.TemaVCisleNode): - self.tema_in_path = True - - def add_edit_options(self): - self.deletable = tnltt.deletable(self) - self.editable_siblings = tnltt.editableSiblings(self) - self.editable_children = tnltt.editableChildren(self) - self.text_only_subtree = tnltt.textOnlySubtree(self) - self.can_podvesit_za = tnltt.canPodvesitZa(self) - self.can_podvesit_pred = tnltt.canPodvesitPred(self) - self.appendable_children = tnltt.appendableChildren(self) - print("appChld",self.appendable_children) - if self.parent: - self.appendable_siblings = tnltt.appendableChildren(self.parent) - else: - self.appendable_siblings = [] - @classmethod - def public_above(cls, anode): - """ Returns output of verejne for closest Rocnik, Cislo or Problem above. - (All of them have method verejne.)""" - parent = anode # chceme začít už od konkrétního node včetně - while True: - rocnik = isinstance(parent, s.RocnikNode) - cislo = isinstance(parent, s.CisloNode) - uloha = (isinstance(parent, s.UlohaVzorakNode) or - isinstance(parent, s.UlohaZadaniNode)) - tema = isinstance(parent, s.TemaVCisleNode) - - if (rocnik or cislo or uloha or tema) or parent==None: - break - else: - parent = treelib.get_parent(parent) - if rocnik: - return parent.rocnik.verejne() - elif cislo: - return parent.cislo.verejne() - elif uloha: - return parent.uloha.verejne() - elif tema: - return parent.tema.verejne() - elif None: - print("Existuje TreeNode, který není pod číslem, ročníkem, úlohou" - "ani tématem. {}".format(anode)) - return False - - @classmethod - def all_public_children(cls, anode): - for ch in treelib.all_children(anode): - if TNLData.public_above(ch): - yield ch - else: - continue - - @classmethod - def from_treenode(cls, anode, user, parent=None, index=None): - if TNLData.public_above(anode) or user.has_perm('auth.org'): - out = cls(anode,parent,index) - else: - raise PermissionDenied() - - if user.has_perm('auth.org'): - enum_children = enumerate(treelib.all_children(anode)) - else: - enum_children = enumerate(TNLData.all_public_children(anode)) - - for (idx,ch) in enum_children: - outitem = cls.from_treenode(ch, user, out, idx) - out.children.append(outitem) - out.add_edit_options() - return out - - @classmethod - def from_tnldata_list(cls, tnllist): - """Vyrobíme virtuální TNL, který nemá obsah, ale má za potomky všechna zadaná TNLData""" - result = cls(None) - for idx, tnl in enumerate(tnllist): - result.children.append(tnl) - tnl.parent = result - tnl.index = idx - result.add_edit_options() - return result - - @classmethod - def filter_treenode(cls, treenode, predicate): - tnll = cls._filter_treenode_recursive(treenode, predicate) # TreeNodeList List :-) - return TNLData.from_tnldata_list(tnll) - - @classmethod - def _filter_treenode_recursive(cls, treenode, predicate): - if predicate(treenode): - return [cls.from_treenode(treenode)] - else: - found = [] - for tn in treelib.all_children(treenode): - result = cls.filter_treenode(tn, predicate) - # Result by v tuhle chvíli měl být seznam TNLDat odpovídající treenodům, jež matchnuly predikát. - for tnl in result: - found.append(tnl) - return found - - def to_json(self): - #self.node = anode - #self.children = [] - #self.parent = parent - #self.tema_in_path = False - #self.index = index - out = {} - out['node'] = self.sernode.data - out['children'] = [n.to_json() for n in self.children] - out['tema_in_path'] = self.tema_in_path - out['index'] = self.index - out['deletable'] = self.deletable - out['editable_siblings'] = self.editable_siblings - out['editable_children'] = self.editable_children - out['text_only_subtree'] = self.text_only_subtree - out['can_podvesit_za'] = self.can_podvesit_za - out['can_podvesit_pod'] = self.can_podvesit_pred - out['appendable_children'] = self.appendable_children - out['appendable_siblings'] = self.appendable_siblings - - return out - - - - def __repr__(self): - return("TNL({})".format(self.node)) - # FIXME: Pozor, níž je ještě jeden ProblemView! #class ProblemView(generic.DetailView): From a015520e413af67af6eeff38ef617513007552c7 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Mon, 22 Nov 2021 21:19:54 +0100 Subject: [PATCH 3/5] =?UTF-8?q?Smaz=C3=A1ny=20koment=C3=A1=C5=99ov=C3=A9?= =?UTF-8?q?=20aplikace=20[DATA=20DROP!]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nefungovalo to, a stejně už se nepoužívají. Data viz dumpy databáze… --- mamweb/settings_common.py | 8 -------- mamweb/templates/base.html | 3 --- mamweb/urls.py | 1 - requirements.txt | 3 --- 4 files changed, 15 deletions(-) diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index fa070a86..58e8c638 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -109,9 +109,7 @@ INSTALLED_APPS = ( 'dal', 'dal_select2', - 'fluent_comments', 'crispy_forms', - 'threadedcomments', 'django_comments', 'django.contrib.flatpages', @@ -221,12 +219,6 @@ REST_FRAMEWORK = { 'PAGE_SIZE': 100 } -# Comments - -COMMENTS_APP = 'fluent_comments' -#COMMENTS_APP = 'threadedcomments' -FLUENT_COMMENTS_EXCLUDE_FIELDS = ('name', 'email', 'url', 'title') - # SECURITY WARNING: keep the secret key used in production secret! # Create file 'django.secret' in every install (it is not kept in git) diff --git a/mamweb/templates/base.html b/mamweb/templates/base.html index dfd8362e..1d292f95 100644 --- a/mamweb/templates/base.html +++ b/mamweb/templates/base.html @@ -15,9 +15,6 @@ - - - {# nastavení MathJaxu, aby nahrazoval i matiku obalenou jednoduchými $ #}