This commit is contained in:
Flatlogic Bot 2025-11-28 15:45:12 +00:00
parent 3477fc639b
commit 9be23e36d1
4 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
{% extends 'base.html' %}
{% load static %}
{% load core_tags %}
{% block title %}AI Task Manager - Home{% endblock %}
@ -69,7 +70,7 @@
<td>{{ item.description|default:"" }}</td>
<td>
{% if item.tags %}
{% for tag in item.tags.split:','|slice:":3" %}
{% for tag in item.tags|split:","|slice:":3" %}
<span class="badge bg-secondary">{{ tag }}</span>
{% endfor %}
{% endif %}

View File

@ -35,7 +35,7 @@
<p class="card-text small">{{ item.description|default:""|truncatewords:15 }}</p>
{% if item.tags %}
<div class="tags">
{% for tag in item.tags.split:','|slice:":3" %}
{% for tag in item.tags|split:","|slice:":3" %}
<span class="badge bg-secondary">{{ tag }}</span>
{% endfor %}
</div>

View File

@ -5,3 +5,15 @@ register = template.Library()
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
@register.filter
def get_obj_attr(obj, attr):
return getattr(obj, attr, None)
@register.filter
def split(value, key):
"""
Returns the value turned into a list.
"""
return value.split(key)