Quirks in Django's template language

Django Rusty Templates Since September 2024, I have been building a reimplementation of Django’s templating language in Rust, called Django Rusty Templates. During this process, I have discovered several weird edge-cases and bugs. Scientific notation Django supports writing floats in scientific notation (e.g. 6.28e23) in templates. However using a negative exponent was not supported: "{{ foo|default:5.2e-3 }}" Traceback (most recent call last): TemplateSyntaxError: Could not parse the remainder: '-3' from 'foo|default:5.2e-3' >>> from django.template.base import Template >>> Template("{{ foo|default:5.2e-3 }}") Traceback (most recent call last): ... raise TemplateSyntaxError( django.template.exceptions.TemplateSyntaxError: Could not parse the remainder: '-3' from 'foo|default:5.2e-3' ...

April 26, 2025