C
C
carrallton2020-07-24 03:04:11
Django
carrallton, 2020-07-24 03:04:11

Invalid filter: 'intcomma' What's the problem?

Created a page template in django-admin.

{% extends "admin/change_list.html" %}
{% block content_title %}
    <h1> Sales Summary </h1>
{% endblock %}
{% block result_list %}
    <div class="results">
        <table>
            <thead>
                <tr>
                    <th>
                        <div class="text">
                            <a href="#">Category</a>
                        </div>
                    </th>
                    <th>
                        <div class="text">
                            <a href="#">Total</a>
                        </div>
                    </th>
                    <th>
                        <div class="text">
                            <a href="#">Total Orders</a>
                        </div>
                    </th>
                    <th>
                        <div class="text">
                            <a href="#"><strong>% Of Total Orders</strong></a>
                        </div>
                    </th>
                </tr>
            </thead>

            <tbody>
                {% for row in summary %}
                <tr class="{% cycle 'row1' 'row2' %}">
                    <td> {{ row.sale__category__name }} </td>
                    <td> {{ row.total |intcomma }} </td>
                    <td> {{ row.total_sales | default:0 |intcomma }}$ </td>
                    <td>
                        <strong>
                            {{ row.total_sales |
                                default:0 |
                                percentof:summary_total.total_sales }}
                        </strong>
                    </td>
                </tr>
                {% endfor %}
            </tbody>

        </table>
    </div>
{% endblock %}
{% block pagination %}{% endblock %}


When trying, it gives a syntax error: Invalid filter: 'intcomma'. What is the problem? I read the documentation, it's easy to use.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question