1

さて、DateTimeProperty()タイプの日時フィールドを持つデータベースモデルがあります。テンプレートでこの値をフォーマットしたいので、次を使用しています。

{{row.datetime | date:'M j、H:i'}}

ただし、GoogleAppEngineは次の例外をスローします。

トレースバック(最後の最後の呼び出し):
  ファイル"/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py"、515行目、__ call__
    handler.get(* groups)
  ファイル"/base/data/home/apps/.../1.348530548823349202/main.py"、22行目、get
    'nominations':row.nominations} for row in data]
  ファイル"/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/template.py"、行155、レンダリング
    t = load(template_path、debug)
  ファイル"/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/template.py"、行183、読み込み中
    template = django.template.loader.get_template(file_name)
  get_templateのファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/loader.py"、行80
    template = get_template_from_string(source、origin、template_name)
  get_template_from_stringのファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/loader.py"、行88
    テンプレートを返す(ソース、オリジン、名前)
  ファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py"、158行目、__ init__
    self.nodelist = compile_string(template_string、origin)
  ファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py"、174行目、compile_string
    parser.parse()を返します
  ファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py"、273行目、解析中
    compiled_result = compile_func(self、token)
  ファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/defaulttags.py"、544行目、do_for
    nodelist_loop = parser.parse(('endfor'、))
  ファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py"、254行目、解析中
    filter_expression = self.compile_filter(token.contents)
  compile_filterのファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py"、行338
    FilterExpression(token、self)を返します
  ファイル"/base/python_runtime/python_lib/versions/third_party/django-0.96/django/template/__init__.py"、行558、__ init__
    TemplateSyntaxError、 "残りを解析できませんでした:%s"%token [upto:]
TemplateSyntaxError:残りを解析できませんでした::'M j、H:i'

私は何が間違っているのですか?

前もって感謝します。

4

1 に答える 1

3

試す

{{row.datetime|date:"M j, H:i"}}
于 2011-03-25T15:29:52.513 に答える