![見出し画像](https://assets.st-note.com/production/uploads/images/100585622/rectangle_large_type_2_3693bd6a1008da7b60005cc8e1961bd6.png?width=1200)
Photo by
koheis_2
【IT】Djangoテンプレート内でのフィルターのエラー(Could not parse the remainder: '|' from '|')
皆さま
こんにちは
DjangoでTemplateを作成していたところ、
以下のエラーが発生しました。
「Could not parse the remainder: '|' from '|'」
![](https://assets.st-note.com/img/1679138753584-7aTvzaeIY0.jpg?width=1200)
エラーの構文は以下となります。
{% if object_list | length != 0 %}
<処理>
・
・
・
・
{% endif %}
よく観察するとフィルターにスペースが入っておりました。
VSCodeで意図せず勝手にスペースを挿入されてしました。
VSCodeを確認すると拡張機能のいくつかが
読み込み待ちとなっておりました。
再起動して、再度有効化して予期しない
自動スペースの挿入は直りました。
公式ホームページより(スペースは入ってません)
フィルター¶
if 内でフィルタを使うこともできます。例を示します:
{% if messages|length >= 100 %}
You have lots of messages today!
{% endif %}
では