blog-markdown #31
|
@ -1,13 +1,21 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load helper_tags %}
|
||||||
{% get_current_language as LANGUAGE_CODE %}
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
{% block languagecode %}{{ LANGUAGE_CODE }}{% endblock languagecode %}
|
{% block languagecode %}
|
||||||
{% block title %}{% translate "cscherr.de" %} - {% translate "Blog" %}{% endblock title %}
|
{{ LANGUAGE_CODE }}
|
||||||
|
{% endblock languagecode %}
|
||||||
|
{% block title %}
|
||||||
|
{% translate "cscherr.de" %} - {% translate "Blog" %}
|
||||||
|
{% endblock title %}
|
||||||
{% block nav %}
|
{% block nav %}
|
||||||
{% include 'nav.html' %}
|
{% include 'nav.html' %}
|
||||||
{% endblock nav %}
|
{% endblock nav %}
|
||||||
{% block headscripts %}
|
{% block headscripts %}
|
||||||
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3.0.0/es5/tex-mml-chtml.js"></script>
|
<script type="text/javascript"
|
||||||
|
id="MathJax-script"
|
||||||
|
async
|
||||||
|
src="https://cdn.jsdelivr.net/npm/mathjax@3.0.0/es5/tex-mml-chtml.js"></script>
|
||||||
{% endblock headscripts %}
|
{% endblock headscripts %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="container-xl">
|
<div class="container-xl">
|
||||||
|
@ -16,14 +24,26 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
{% if LANGUAGE_CODE == "de" %}
|
{% if LANGUAGE_CODE == "de" %}
|
||||||
<h1 class="">{{ post.title_de }}<br>
|
<h1 class="">
|
||||||
<small class="fs-4">{{ post.subtitle_de }}</small></h1><br>
|
{{ post.title_de }}
|
||||||
|
<br>
|
||||||
|
<small class="fs-4">{{ post.subtitle_de }}</small>
|
||||||
|
</h1>
|
||||||
|
<br>
|
||||||
{% elif LANGUAGE_CODE == "en" %}
|
{% elif LANGUAGE_CODE == "en" %}
|
||||||
<h1 class="">{{ post.title_en }}<br>
|
<h1 class="">
|
||||||
<small class="fs-4">{{ post.subtitle_en }}</small></h1><br>
|
{{ post.title_en }}
|
||||||
|
<br>
|
||||||
|
<small class="fs-4">{{ post.subtitle_en }}</small>
|
||||||
|
</h1>
|
||||||
|
<br>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h1 class="">{{ post.title_en }}<br>
|
<h1 class="">
|
||||||
<small class="fs-4">{{ post.subtitle_en }}</small></h1><br>
|
{{ post.title_en }}
|
||||||
|
<br>
|
||||||
|
<small class="fs-4">{{ post.subtitle_en }}</small>
|
||||||
|
</h1>
|
||||||
|
<br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,8 +53,8 @@
|
||||||
<img src="{{ post.thumbnail.url }}" alt="thumbnail" class="img-fluid">
|
<img src="{{ post.thumbnail.url }}" alt="thumbnail" class="img-fluid">
|
||||||
</picture>
|
</picture>
|
||||||
</div>
|
</div>
|
||||||
<div class="col px-3">
|
<div class="row px-3">
|
||||||
<div class="col">
|
<div class="">
|
||||||
{% if LANGUAGE_CODE == "de" %}
|
{% if LANGUAGE_CODE == "de" %}
|
||||||
<p class="lead">{{ post.desc_de }}</p>
|
<p class="lead">{{ post.desc_de }}</p>
|
||||||
{% elif LANGUAGE_CODE == "en" %}
|
{% elif LANGUAGE_CODE == "en" %}
|
||||||
|
@ -43,11 +63,10 @@
|
||||||
<p class="lead">{{ post.desc_en }}</p>
|
<p class="lead">{{ post.desc_en }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="">
|
||||||
<p>{{ post.date }}</p>
|
<p>
|
||||||
</div>
|
<b>{{ post.category.name }}<b>
|
||||||
<div class="col">
|
</p>
|
||||||
<p>{{ post.category.name }}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,6 +82,16 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col">
|
||||||
|
{% format_time post.date as date %}
|
||||||
|
<p>{% trans "published" %}: {{ date }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
{% format_time post.update as update %}
|
||||||
|
<p>{% trans "updated" %}: {{ update }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
{% include 'blog/featured.html' %}
|
{% include 'blog/featured.html' %}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django.template import Library
|
from django.template import Library
|
||||||
from django.urls import resolve, reverse
|
from django.urls import resolve, reverse
|
||||||
from django.utils.translation import activate, get_language
|
from django.utils.translation import activate, get_language
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -9,6 +10,9 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
register = Library()
|
register = Library()
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def format_time(timestamp: datetime) -> str:
|
||||||
|
return timestamp.strftime("%F %H:%M:%S")
|
||||||
|
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
def change_lang(context, lang="de", *args, **kwargs):
|
def change_lang(context, lang="de", *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue