django - 如何为模板中的一个变量禁用 USE_THOUSAND_SEPARATOR?

标签 django django-templates

我的 settings.pyUSE_THOUSAND_SEPARATOR = True 因为这通常是我想要在我的模板中使用的内容。

但是,我可以做些什么来防止模板中的一个变量出现这种默认行为?

{{ project_id }} 当前打印“9,324”,但我希望它显示“9324”。

干杯!

最佳答案

Filter stringformat formats the variable according to the argument, a string formatting specifier. This specifier uses the printf-style String Formatting syntax, with the exception that the leading “%” is dropped

{{ project_id|<b>stringformat:"s"</b> }}

关于django - 如何为模板中的一个变量禁用 USE_THOUSAND_SEPARATOR?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62721251/

相关文章:

javascript - 在发布到 Django View 之前将复选框 'on' 转换为 bool 值

django 模板扩展 - 除一个模板外的所有模板

python - Django/Python 世界中是否有与 WordPress 的 SimplePie 插件等效的东西?

Django 模板在句号上分割文本

Django 应用程序重定向所有 URL

python - 连接 Django 和 MSSQL 服务器

python - 删除/创建与删除/更新的性能

Django ModelAdmin - 字段集...表单中缺少字段 'date'

django-templates - Django : user info in template

python - 对 'edit' 进行反向操作,未找到参数 '(9,)' 和关键字参数 '{}'。尝试了 0 个模式 : []