I create my own custom filter tags to using in my project but every time i put in my HTML it just product this errors
I don't where i do wrong, I try putting the {%load tag%} with child templates, it didn't work
<div class = "float-right my-4 chartjs-render-monitor" id="chartContainerPH" style="width: 49%; height: 400px;display: inline-block; background-color:#FDFDFD;">
<center>
<a class="title-link" href="{%url 'ph' %}">PH:</a>
<p> {{tank_system.PH|latest}}, </p>
</center>
</div>
and here my code for my custom filter
from django import template
register = template.Library()
@register.filter('latest', latest)
def custom_last(value):
last = None
try:
last = value[-1]
except AssertionError:
try:
last = value.reverse()[0]
except IndexError:
pass
return last
my views
from django.shortcuts import render
from django.views.generic import TemplateView
from zigview.models import tank_system
from django.contrib.auth.decorators import login_required
import logging
logger = logging.getLogger(__name__)
try:
@login_required(login_url='/accounts/login/')
def index(request): #gose to main dashboard page
tank = tank_system.objects.all
return render(request, 'FrounterWeb/extends/includes.html', {'tank': tank})
except:
logger.error('index page request failed/errors')
I intend to use two custom filter