... ケープ と フィルタとタイムゾーン の中で説明されています。 文字列を要するテンプレートフィルタ django.template.defaultfilters. stringfilter () 第 1 引数として文字数を要求するだけのテンプレートフィルタを記述している場合、デコレータ stringfilter を使う必要がありま ... 関数に渡される前にオブジェクトを文字列に変換します。 from django import template from django.template.defaultfilters import stringfilter register = template . Library () @register . filter @stringfilter def lower ( value ): return value . lower () これにより、 ... ... eturn value noop . is_safe = True However, this technique caused some problems in combination with decorators, especially @stringfilter . Now, the flags are keyword arguments of @register.filter : @register . filter ( is_safe = True ) def noop ( value ): ret ... 2026年10月08日