... す。 Django ではこの方法に従っていませんが、それは以下の理由からです: 特定のファイルのデフォルトの翻訳メソッドとして gettext_lazy() を使うべき場合もあります。グローバル名前空間に _() がないと、開発者はどれが最も適切な翻訳関数かを考えなければなりません。 ... で使われる) xgettext が動作する方法のせいで、単一の文字列引数を持つ関数のみが _ として import できます。 gettext() gettext_lazy() この例では、 "Welcome to my site." というテキストが翻訳文字列としてマークされています: from django.http import HttpRespo ... h = pgettext ( "month name" , "May" ) もしくは: from django.db import models from django.utils.translation import pgettext_lazy class MyThing ( models . Model ): name = models . CharField ( help_text = pgettext_lazy ( "help text for MyThing model" , ... ... す。 Django ではこの方法に従っていませんが、それは以下の理由からです: 特定のファイルのデフォルトの翻訳メソッドとして gettext_lazy() を使うべき場合もあります。グローバル名前空間に _() がないと、開発者はどれが最も適切な翻訳関数かを考えなければなりません。 ... で使われる) xgettext が動作する方法のせいで、単一の文字列引数を持つ関数のみが _ として import できます。 gettext() gettext_lazy() この例では、 "Welcome to my site." というテキストが翻訳文字列としてマークされています: from django.http import HttpRespo ... h = pgettext ( "month name" , "May" ) もしくは: from django.db import models from django.utils.translation import pgettext_lazy class MyThing ( models . Model ): name = models . CharField ( help_text = pgettext_lazy ( "help text for MyThing model" , ... ... verts the result of a method with a single cls argument into a property that can be accessed directly from the class. keep_lazy ( func , * resultclasses ) [ソース] ¶ Djangoでは、文字列を最初の引数として受け取り、その文字列に何らかの処理を行う多くのユ ... 設定が正しくない可能性があります)、すぐに文字列に変換したくないでしょう。 このような場合には、 django.utils.functional.keep_lazy() デコレータを使用してください。これは、関数が引数の1つとして遅延評価される翻訳を持つ場合に、関数の評価を文字列に変換する必 ... 要があるまで遅らせるように変更します。 例: from django.utils.functional import keep_lazy , keep_lazy_text def fancy_utility_function ( s , * args , ** kwargs ): # Do some conversion on string 's' ... fancy_utili ... ... verts the result of a method with a single cls argument into a property that can be accessed directly from the class. keep_lazy ( func , * resultclasses ) [ソース] ¶ Djangoでは、文字列を最初の引数として受け取り、その文字列に何らかの処理を行う多くのユ ... 設定が正しくない可能性があります)、すぐに文字列に変換したくないでしょう。 このような場合には、 django.utils.functional.keep_lazy() デコレータを使用してください。これは、関数が引数の1つとして遅延評価される翻訳を持つ場合に、関数の評価を文字列に変換する必 ... 要があるまで遅らせるように変更します。 例: from django.utils.functional import keep_lazy , keep_lazy_text def fancy_utility_function ( s , * args , ** kwargs ): # Do some conversion on string 's' ... fancy_utili ... ... lateSyntaxError from django.template.backends.base import BaseEngine from django.template.backends.utils import csrf_input_lazy , csrf_token_lazy import foobar class FooBar ( BaseEngine ): # Name of the subdirectory containing the templates for this ... text is None : context = {} if request is not None : context [ "request" ] = request context [ "csrf_input" ] = csrf_input_lazy ( request ) context [ "csrf_token" ] = csrf_token_lazy ( request ) return self . template . render ( context ) 詳しい情報は ... プレート self カスタム foobar context エンジン lines csrf request postmortem バックエンド params import TemplateDoesNotExist lazy engine None 属性 backends BaseEngine TemplateSyntaxError input token init クイック検索 Last update: 2026年10月09日 « previ ... ... lateSyntaxError from django.template.backends.base import BaseEngine from django.template.backends.utils import csrf_input_lazy , csrf_token_lazy import foobar class FooBar ( BaseEngine ): # Name of the subdirectory containing the templates for this ... text is None : context = {} if request is not None : context [ "request" ] = request context [ "csrf_input" ] = csrf_input_lazy ( request ) context [ "csrf_token" ] = csrf_token_lazy ( request ) return self . template . render ( context ) 詳しい情報は ... ... for: urllib.parse.quote() , quote_plus() , unquote() , and unquote_plus() . django.utils.translation.ugettext() , ugettext_lazy() , ugettext_noop() , ungettext() , and ungettext_lazy() are deprecated in favor of the functions that they're aliases for ... : django.utils.translation.gettext() , gettext_lazy() , gettext_noop() , ngettext() , and ngettext_lazy() . To limit creation of sessions and hence favor some caching strateg ... pe_entities() is deprecated in favor of html.unescape() . Note that unlike unescape_entities() , html.unescape() evaluates lazy strings immediately. To avoid possible confusion as to effective scope, the private internal utility is_safe_url() is rena ... ... for: urllib.parse.quote() , quote_plus() , unquote() , and unquote_plus() . django.utils.translation.ugettext() , ugettext_lazy() , ugettext_noop() , ungettext() , and ungettext_lazy() are deprecated in favor of the functions that they're aliases for ... : django.utils.translation.gettext() , gettext_lazy() , gettext_noop() , ngettext() , and ngettext_lazy() . To limit creation of sessions and hence favor some caching strateg ... pe_entities() is deprecated in favor of html.unescape() . Note that unlike unescape_entities() , html.unescape() evaluates lazy strings immediately. To avoid possible confusion as to effective scope, the private internal utility is_safe_url() is rena ... ... regression with an __in=qs lookup for a ForeignKey with to_field set ( #26196 ). forms.FileField および utils.translation.lazy_number() が pickle できるようになりました ( #26212 )。 None の値を持つ RangeField および ArrayField のシリアライズを修正し ... anager instances from sharing their cache ( #26286 ). Reverted a change in Django 1.9.2 ( #25858 ) that prevented relative lazy relationships defined on abstract models to be resolved according to their concrete model's app_label ( #26186 ). 目次 Dja ... ... regression with an __in=qs lookup for a ForeignKey with to_field set ( #26196 ). forms.FileField および utils.translation.lazy_number() が pickle できるようになりました ( #26212 )。 None の値を持つ RangeField および ArrayField のシリアライズを修正し ... anager instances from sharing their cache ( #26286 ). Reverted a change in Django 1.9.2 ( #25858 ) that prevented relative lazy relationships defined on abstract models to be resolved according to their concrete model's app_label ( #26186 ). 目次 Dja ... 2026年10月08日