Compare commits

..

1 commit

Author SHA1 Message Date
9a4f535ca2 generate category 2023-10-01 18:06:07 +02:00
2 changed files with 36 additions and 57 deletions

View file

@ -279,7 +279,6 @@ class BlogPost(Searchable):
try: try:
obj = BlogPost(langs=file[0], slug=file[1]) obj = BlogPost(langs=file[0], slug=file[1])
obj.sync_file() obj.sync_file()
obj.regenerate()
obj.save() obj.save()
except Exception as e: except Exception as e:
logger.error(f"Could not create BlogPost for '{file[1]}': {e}") logger.error(f"Could not create BlogPost for '{file[1]}': {e}")

View file

@ -1,60 +1,40 @@
{% load i18n %} {% get_current_language as LANGUAGE_CODE %} {% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<div class="container-lg mt-5"> <div class="container-lg mt-5">
<h4 class="">{% trans "Featured" %}</h4> <h4 class="">{% trans "Featured" %}</h4>
<div class="row row-cols-1 row-cols-md-5 my-4"> <div class="row row-cols-1 row-cols-md-5 my-4">
{% for post in featured_posts %} {% for post in featured_posts %}
<div class="card col m-2 p-0"> <div class="card col m-2 p-0">
<a <a class="text-reset link-offset-2 link-underline link-underline-opacity-0" href=" {% url 'blog:post' post.category.slug post.slug %}">
class="text-reset link-offset-2 link-underline link-underline-opacity-0" <img src="{{ post.thumbnail.url }}" class="card-img-top img-fluid" style="max-height: 150px;" alt="thumbnail">
href=" {% url 'blog:post' post.category.slug post.slug %}" <div class="card-body" style="height: 100px;">
> {% if LANGUAGE_CODE == "de" %}
<img <h5 class="card-title">{{ post.title_de }}<small class="text-body-secondary">{{ post.subtitle }}</small></h5>
src="{{ post.thumbnail.url }}" <p class="card-text">{{ post.desc_de }}</p>
class="card-img-top img-fluid" {% elif LANGUAGE_CODE == "en" %}
style="max-height: 150px" <h5 class="card-title">{{ post.title_en }}<small class="text-body-secondary">{{ post.subtitle }}</small></h5>
alt="thumbnail" <p class="card-text">{{ post.desc_en }}</p>
/> {% else %}
<div class="card-body" style="height: 100px"> <h5 class="card-title">{{ post.title_en }}<small class="text-body-secondary">{{ post.subtitle }}</small></h5>
{% if LANGUAGE_CODE == "de" %} <p class="card-text">{{ post.desc_en }}</p>
<h5 class="card-title"> {% endif %}
{{ post.title_de }}<small class="text-body-secondary" </div>
>{{ post.subtitle }}</small <div class="container pt-5">
> <ul class="list-group list-group-flush">
</h5> <li class="list-group-item">{% translate "category" %}: <b>{{ post.category.name }}</b></li>
<p class="card-text">{{ post.desc_de }}</p> {% for keyword in post.keywords.all %}
{% elif LANGUAGE_CODE == "en" %} {% if LANGUAGE_CODE == "de" %}
<h5 class="card-title"> <li class="list-group-item">{{ keyword.text_de }}</li>
{{ post.title_en }}<small class="text-body-secondary" {% elif LANGUAGE_CODE == "en" %}
>{{ post.subtitle }}</small <li class="list-group-item">{{ keyword.text_en }}</li>
> {% else %}
</h5> <li class="list-group-item">{{ keyword.text_en }}</li>
<p class="card-text">{{ post.desc_en }}</p> {% endif %}
{% else %} {% endfor %}
<h5 class="card-title"> </ul>
{{ post.title_en }}<small class="text-body-secondary" </div>
>{{ post.subtitle }}</small </a>
>
</h5>
<p class="card-text">{{ post.desc_en }}</p>
{% endif %}
</div> </div>
<div class="container pt-5"> {% endfor %}
<ul class="list-group list-group-flush">
<li class="list-group-item">
{% translate "category" %}: <b>{{ post.category.name }}</b>
</li>
{% for keyword in post.keywords.all %} {% if LANGUAGE_CODE == "de"
%}
<li class="list-group-item">{{ keyword.text_de }}</li>
{% elif LANGUAGE_CODE == "en" %}
<li class="list-group-item">{{ keyword.text_en }}</li>
{% else %}
<li class="list-group-item">{{ keyword.text_en }}</li>
{% endif %} {% endfor %}
</ul>
</div>
</a>
</div> </div>
{% endfor %}
</div>
</div> </div>