Prozatímní zveřejňování čísla spolu s jeho Úlohami a Tématy
This commit is contained in:
parent
224a5e5d23
commit
6255c9c957
1 changed files with 33 additions and 17 deletions
|
@ -10,6 +10,9 @@ from django_reverse_admin import ReverseModelAdmin
|
|||
from solo.admin import SingletonModelAdmin
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from seminar.views.vysledkovka import hlavni_problem
|
||||
# TODO Přesunout do utils
|
||||
|
||||
|
||||
# Todo: reversion
|
||||
|
||||
|
@ -58,23 +61,36 @@ class CisloAdmin(admin.ModelAdmin):
|
|||
|
||||
def force_publish(self,request,queryset):
|
||||
for cislo in queryset:
|
||||
cn = m.CisloNode.objects.get(cislo=cislo)
|
||||
for ch in tl.all_children(cn):
|
||||
print(ch)
|
||||
if isinstance(ch, m.TemaVCisleNode):
|
||||
if ch.tema.stav not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
ch.tema.stav = m.Problem.STAV_ZADANY
|
||||
ch.tema.save()
|
||||
|
||||
if isinstance(ch, m.UlohaZadaniNode) or isinstance(ch, m.UlohaVzorakNode):
|
||||
if ch.uloha.stav not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
ch.uloha.stav = m.Problem.STAV_ZADANY
|
||||
ch.uloha.save()
|
||||
if isinstance(ch, m.ReseniNode):
|
||||
for problem in ch.reseni.problem_set:
|
||||
if problem not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
problem.stav = m.Problem.STAV_ZADANY
|
||||
problem.save()
|
||||
# cn = m.CisloNode.objects.get(cislo=cislo)
|
||||
# for ch in tl.all_children(cn):
|
||||
# if isinstance(ch, m.TemaVCisleNode):
|
||||
# if ch.tema.stav not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
# ch.tema.stav = m.Problem.STAV_ZADANY
|
||||
# ch.tema.save()
|
||||
#
|
||||
# if isinstance(ch, m.UlohaZadaniNode) or isinstance(ch, m.UlohaVzorakNode):
|
||||
# if ch.uloha.stav not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
# ch.uloha.stav = m.Problem.STAV_ZADANY
|
||||
# ch.uloha.save()
|
||||
# if isinstance(ch, m.ReseniNode):
|
||||
# for problem in ch.reseni.problem_set:
|
||||
# if problem not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
# problem.stav = m.Problem.STAV_ZADANY
|
||||
# problem.save()
|
||||
|
||||
for ch in m.Uloha.objects.filter(cislo_zadani=cislo):
|
||||
if ch.stav not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
ch.stav = m.Problem.STAV_ZADANY
|
||||
ch.save()
|
||||
|
||||
hp = hlavni_problem(ch)
|
||||
if hp.stav not in (m.Problem.STAV_ZADANY, m.Problem.STAV_VYRESENY):
|
||||
hp.stav = m.Problem.STAV_ZADANY
|
||||
hp.save()
|
||||
|
||||
# TODO Řešení, vzoráky?
|
||||
# TODO Konfera/Článek?
|
||||
|
||||
cislo.verejne_db = True
|
||||
cislo.save()
|
||||
|
||||
|
|
Loading…
Reference in a new issue