From 85c3969c50eac28758479d1dd942a322c82fc12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Sun, 4 Aug 2024 19:21:46 +0200 Subject: [PATCH] seminar/templatetags --- .../templates/odevzdavatko/tabulka.html | 1 - seminar/templatetags/utils.py | 19 ------------------- {seminar => tvorba}/templatetags/__init__.py | 0 {seminar => tvorba}/templatetags/deadliny.py | 0 {seminar => various}/templatetags/tex.py | 0 5 files changed, 20 deletions(-) delete mode 100644 seminar/templatetags/utils.py rename {seminar => tvorba}/templatetags/__init__.py (100%) rename {seminar => tvorba}/templatetags/deadliny.py (100%) rename {seminar => various}/templatetags/tex.py (100%) diff --git a/odevzdavatko/templates/odevzdavatko/tabulka.html b/odevzdavatko/templates/odevzdavatko/tabulka.html index 7ee90ea9..cfbe0e6f 100644 --- a/odevzdavatko/templates/odevzdavatko/tabulka.html +++ b/odevzdavatko/templates/odevzdavatko/tabulka.html @@ -1,6 +1,5 @@ {% extends "base.html" %} -{% load utils %} {# Možná by mohlo být někde výš v hierarchii templatů... #} {% load barvy_reseni %} {% block content %} diff --git a/seminar/templatetags/utils.py b/seminar/templatetags/utils.py deleted file mode 100644 index ca400050..00000000 --- a/seminar/templatetags/utils.py +++ /dev/null @@ -1,19 +0,0 @@ -from django import template -from django.utils.safestring import mark_safe -from datetime import datetime, timedelta -from mamweb.settings import TIME_ZONE -import logging -register = template.Library() - -logger = logging.getLogger(__name__) - -@register.filter(name='kratke_datum', expects_localtime=True) -def kratke_datum(dt): - # None dává None, ne-datum dává False, aby se daly použít filtry typu "default". - if dt is None: - return None - if not isinstance(dt, datetime): - logger.warning(f"Špatné volání filtru {__name__}: {dt}") - return False - out = f'' - return mark_safe(out) diff --git a/seminar/templatetags/__init__.py b/tvorba/templatetags/__init__.py similarity index 100% rename from seminar/templatetags/__init__.py rename to tvorba/templatetags/__init__.py diff --git a/seminar/templatetags/deadliny.py b/tvorba/templatetags/deadliny.py similarity index 100% rename from seminar/templatetags/deadliny.py rename to tvorba/templatetags/deadliny.py diff --git a/seminar/templatetags/tex.py b/various/templatetags/tex.py similarity index 100% rename from seminar/templatetags/tex.py rename to various/templatetags/tex.py