我的 settings.py
有 USE_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/