Anet
5 years ago
8 changed files with 376 additions and 145 deletions
@ -0,0 +1,27 @@ |
|||
# Generated by Django 2.2.9 on 2020-03-18 23:59 |
|||
|
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('seminar', '0077_auto_20200318_2146'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='OtisteneReseniNode', |
|||
fields=[ |
|||
('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), |
|||
('reseni', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Reseni', verbose_name='reseni')), |
|||
], |
|||
options={ |
|||
'verbose_name': 'Otištěné řešení (Node)', |
|||
'verbose_name_plural': 'Otištěná řešení (Node)', |
|||
'db_table': 'seminar_nodes_otistene_reseni', |
|||
}, |
|||
bases=('seminar.treenode',), |
|||
), |
|||
] |
@ -0,0 +1,10 @@ |
|||
{% extends "seminar/archiv/base_ulohy.html" %} |
|||
|
|||
{% load comments %} |
|||
|
|||
{% block content %} |
|||
|
|||
{%with obj=tnldata depth=1 template_name="seminar/treenode_recursive.html" %} |
|||
{%include template_name%} |
|||
{%endwith%} |
|||
{% endblock content %} |
@ -0,0 +1,28 @@ |
|||
{% load treenodes %} |
|||
{# <b>{{depth}}</b> #} |
|||
<div> |
|||
{% if obj.node|isRocnik %} |
|||
<h{{depth}}> Ročník {{obj.node.rocnik}} </h{{depth}}> |
|||
{% elif obj.node|isCislo %} |
|||
<h{{depth}}> Číslo {{obj.node.cislo}} </h{{depth}}> |
|||
{% elif obj.node|isTemaVCisle %} |
|||
<h{{depth}}> Téma {{obj.node.tema.nazev}} </h{{depth}}> |
|||
{% elif obj.node|isUlohaZadani %} |
|||
<h{{depth}}>Úloha {{obj.node.uloha.kod_v_rocniku}} ({{obj.node.uloha.max_body}} b)</h{{depth}}> |
|||
{% elif obj.node|isUlohaVzorak %} |
|||
<h{{depth}}>Řešení: {{obj.node.uloha.kod_v_rocniku}}</h{{depth}}> |
|||
{% elif obj.node|isText %} |
|||
{{obj.node.text.na_web}} |
|||
{% else %} |
|||
Objekt jiného typu {{obj.node}} |
|||
{% endif %} |
|||
{%if obj.children %} |
|||
<div> |
|||
{%for ch in obj.children %} |
|||
{%with obj=ch depth=depth|add:"1" template_name="seminar/treenode_recursive.html" %} |
|||
{%include template_name%} |
|||
{%endwith%} |
|||
{%endfor%} |
|||
</div> |
|||
{%endif%} |
|||
</div> |
@ -0,0 +1,49 @@ |
|||
from django import template |
|||
import seminar.models as m |
|||
|
|||
register = template.Library() |
|||
|
|||
@register.filter |
|||
def isRocnik(value): |
|||
return isinstance(value, m.RocnikNode) |
|||
|
|||
@register.filter |
|||
def isCislo(value): |
|||
return isinstance(value, m.CisloNode) |
|||
|
|||
@register.filter |
|||
def isCast(value): |
|||
return isinstance(value, m.CastNode) |
|||
|
|||
@register.filter |
|||
def isText(value): |
|||
return isinstance(value, m.TextNode) |
|||
|
|||
@register.filter |
|||
def isTemaVCisle(value): |
|||
return isinstance(value, m.TemaVCisleNode) |
|||
|
|||
@register.filter |
|||
def isKonfera(value): |
|||
return isinstance(value, m.KonferaNode) |
|||
|
|||
@register.filter |
|||
def isClanek(value): |
|||
return isinstance(value, m.ClanekNode) |
|||
|
|||
@register.filter |
|||
def isUlohaVzorak(value): |
|||
return isinstance(value, m.UlohaVzorakNode) |
|||
|
|||
@register.filter |
|||
def isUlohaZadani(value): |
|||
return isinstance(value, m.UlohaZadaniNode) |
|||
|
|||
@register.filter |
|||
def isPohadka(value): |
|||
return isinstance(value, m.PohadkaNode) |
|||
|
|||
#@register.filter |
|||
#def isOtisteneReseniNode(value): |
|||
# return isinstance(value, m.OtisteneReseniNode) |
|||
|
Loading…
Reference in new issue