zkrácení názvů problémů v tabulce odevzdaných řešení
This commit is contained in:
parent
f80d4605fc
commit
ec8aa75e17
2 changed files with 15 additions and 1 deletions
|
@ -10,6 +10,8 @@
|
|||
<li>✓ 2. deadline</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
|
||||
{% for rocnik, hodnoceni in podle_rocniku %}
|
||||
<h1>Ročník {{ rocnik }}</h1>
|
||||
<table class="dosla_reseni">
|
||||
|
@ -22,11 +24,14 @@
|
|||
{% for hodn in hodnoceni %}
|
||||
<tr>
|
||||
<td>{{ hodn.reseni.cas_doruceni | date:"d.m.Y H:i"}}</td>
|
||||
<td id="problem">{{ hodn.problem }}</td>
|
||||
<td id="problem"><span title="{{ hodn.problem.nazev }}">{{ hodn.problem.nazev | zkrat_nazev_problemu }}</span></td>
|
||||
<td>{{ hodn.body|default_if_none:"---" }}</td>
|
||||
<td>{{ hodn.reseni.cas_doruceni | deadline_html }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -39,3 +39,12 @@ def deadline_html(datum):
|
|||
TypDeadline.FinalDeadline: 'final_deadline',
|
||||
}
|
||||
return mark_safe(f'<span class="{classes[typ]}">{text}</span>')
|
||||
|
||||
@register.filter(name='zkrat_nazev_problemu')
|
||||
def zkrat_nazev_problemu(nazev):
|
||||
if len(nazev) > 10:
|
||||
if nazev[9] == " ":
|
||||
nazev = nazev[:9] + "..."
|
||||
else:
|
||||
nazev = nazev[:10] + "..."
|
||||
return nazev
|
||||
|
|
Loading…
Reference in a new issue