Как отформатировать число в десятичную дробь в шаблоне django?

Здравствуйте, я пытаюсь отформатировать число (1999) в шаблоне Django в десятичную дробь с 2DP, например, (19.99)

<div class="card-body">
                        <p class="card-text">{{ object.max_price|stringformat:".2f" )} {{object.currency.id}}</p>
                        <p class="card-text">{{object.min_price}} {{object.currency.id}}</p>
                        <p class="card-text">-{{object.discount_percentage}}%</p>
                        <p class="card-text">{{object.recommended_retail_price}} {{object.currency.id}}</p>
</div>

Я получаю эту ошибку:

TemplateSyntaxError at /products

Could not parse the remainder: ' )} {{object.currency.id' from 'object.max_price|stringformat:".2f" )} {{object.currency.id'

Request Method:     GET
Request URL:    http://localhost:8000/products?page=1
Django Version:     4.0
Exception Type:     TemplateSyntaxError
Exception Value:    

Could not parse the remainder: ' )} {{object.currency.id' from 'object.max_price|stringformat:".2f" )} {{object.currency.id'

Я также попробовал использовать floatformat и получил аналогичную ошибку:

TemplateSyntaxError at /products

Could not parse the remainder: ' )} {{object.currency.id' from 'object.max_price|floatformat )} {{object.currency.id'

Request Method:     GET
Request URL:    http://localhost:8000/products?page=1
Django Version:     4.0
Exception Type:     TemplateSyntaxError
Exception Value:    

Could not parse the remainder: ' )} {{object.currency.id' from 'object.max_price|floatformat )} {{object.currency.id'

Как можно отформатировать целое число в шаблоне Django jinja как десятичную дробь в 2DP?

Вы использовали неправильную закрывающую скобку здесь:

{{ object.max_price|stringformat:".2f" )}
Вернуться на верх