... テキスト文字列を対応づける辞書。 指定されていないフィールドについては、 Django はモデルフィールドの help_text を適用します。 labels ¶ ModelFormOptions. labels ¶ フィールド名に対してラベル文字列を対応づける辞書。 指定されていないフィールドについては、 Dja ... form = ModelForm , fields = None , exclude = None , formfield_callback = None , widgets = None , localized_fields = None , labels = None , help_texts = None , error_messages = None , field_classes = None ) [ソース] ¶ 与えられた model に対して ModelForm ... ングされたモデルフィールド名のディクショナリです。 localized_fields は、ローカライズされるべきフィールドの名前のリストです。 labels は、ラベルにマッピングされたモデルフィールド名のディクショナリです。 help_texts は、ヘルプテキストにマッピングされたモデル ... ... テキスト文字列を対応づける辞書。 指定されていないフィールドについては、 Django はモデルフィールドの help_text を適用します。 labels ¶ ModelFormOptions. labels ¶ フィールド名に対してラベル文字列を対応づける辞書。 指定されていないフィールドについては、 Dja ... form = ModelForm , fields = None , exclude = None , formfield_callback = None , widgets = None , localized_fields = None , labels = None , help_texts = None , error_messages = None , field_classes = None ) [ソース] ¶ 与えられた model に対して ModelForm ... ングされたモデルフィールド名のディクショナリです。 localized_fields は、ローカライズされるべきフィールドの名前のリストです。 labels は、ラベルにマッピングされたモデルフィールド名のディクショナリです。 help_texts は、ヘルプテキストにマッピングされたモデル ... ... outer : """ A router to control all database operations on models in the auth and contenttypes applications. """ route_app_labels = { "auth" , "contenttypes" } def db_for_read ( self , model , ** hints ): """ Attempts to read auth and contenttypes mode ... ls go to auth_db. """ if model . _meta . app_label in self . route_app_labels : return "auth_db" return None def db_for_write ( self , model , ** hints ): """ Attempts to write auth and contenttypes m ... odels go to auth_db. """ if model . _meta . app_label in self . route_app_labels : return "auth_db" return None def allow_relation ( self , obj1 , obj2 , ** hints ): """ Allow relations if a model in the ... ... outer : """ A router to control all database operations on models in the auth and contenttypes applications. """ route_app_labels = { "auth" , "contenttypes" } def db_for_read ( self , model , ** hints ): """ Attempts to read auth and contenttypes mode ... ls go to auth_db. """ if model . _meta . app_label in self . route_app_labels : return "auth_db" return None def db_for_write ( self , model , ** hints ): """ Attempts to write auth and contenttypes m ... odels go to auth_db. """ if model . _meta . app_label in self . route_app_labels : return "auth_db" return None def allow_relation ( self , obj1 , obj2 , ** hints ): """ Allow relations if a model in the ... ... す。通常とは異なる方法でテストを読み込む場合は、この属性をオーバーライドします。 メソッド ¶ DiscoverRunner. run_tests ( test_labels , ** kwargs ) [ソース] ¶ テストスイートを実行します。 test_labels は実行するテストを指定するもので、いくつかのフォーマット ... f.debug_mode (デフォルトは False ) に設定することで、テスト環境をセットアップできます。 DiscoverRunner. build_suite ( test_labels = None , ** kwargs ) [ソース] ¶ 指定されたテストラベルにマッチするテストスイートを構築(コンストラクト)します。 test_labe ... べてのテストを検索して実行します。 path/to/directory -- 指定したディレクトリ以下のすべてのテストを検索し、実行します。 test_labels の値が None の場合、テストランナーはカレントディレクトリ以下のすべてのファイルの中から、 pattern (上記参照) にマッチする名 ... ... す。通常とは異なる方法でテストを読み込む場合は、この属性をオーバーライドします。 メソッド ¶ DiscoverRunner. run_tests ( test_labels , ** kwargs ) [ソース] ¶ テストスイートを実行します。 test_labels は実行するテストを指定するもので、いくつかのフォーマット ... f.debug_mode (デフォルトは False ) に設定することで、テスト環境をセットアップできます。 DiscoverRunner. build_suite ( test_labels = None , ** kwargs ) [ソース] ¶ 指定されたテストラベルにマッチするテストスイートを構築(コンストラクト)します。 test_labe ... べてのテストを検索して実行します。 path/to/directory -- 指定したディレクトリ以下のすべてのテストを検索し、実行します。 test_labels の値が None の場合、テストランナーはカレントディレクトリ以下のすべてのファイルの中から、 pattern (上記参照) にマッチする名 ... ... system's standard umask rather than 0o077 (no group or others permissions). バグ修正 ¶ Fixed wrapping of translated action labels in the admin's navigation sidebar for East Asian languages ( #31853 ). Fixed wrapping of long model names in the admin's n ... ... leForm ( ModelForm ): class Meta : error_messages = { NON_FIELD_ERRORS : { "unique_together" : " %(model_name)s 's %(field_labels)s are not unique." , } } save() メソッド ¶ 全ての ModelForm は save() メソッドも持っています。このメソッドは、フォームに結 ... ライドして別のウィジェットを使用する必要があります。 同様に、フィールドをさらにカスタマイズしたい場合、内部の Meta クラスの labels 、 help_texts 、 error_messages と言った属性を指定できます。 例えば、 name フィールドに対する文字列に直面する全てのユーザの ... gettext_lazy as _ class AuthorForm ( ModelForm ): class Meta : model = Author fields = [ "name" , "title" , "birth_date" ] labels = { "name" : _ ( "Writer" ), } help_texts = { "name" : _ ( "Some useful help text." ), } error_messages = { "name" : { "ma ... ... system's standard umask rather than 0o077 (no group or others permissions). バグ修正 ¶ Fixed wrapping of translated action labels in the admin's navigation sidebar for East Asian languages ( #31853 ). Fixed wrapping of long model names in the admin's n ... ... leForm ( ModelForm ): class Meta : error_messages = { NON_FIELD_ERRORS : { "unique_together" : " %(model_name)s 's %(field_labels)s are not unique." , } } save() メソッド ¶ 全ての ModelForm は save() メソッドも持っています。このメソッドは、フォームに結 ... ライドして別のウィジェットを使用する必要があります。 同様に、フィールドをさらにカスタマイズしたい場合、内部の Meta クラスの labels 、 help_texts 、 error_messages と言った属性を指定できます。 例えば、 name フィールドに対する文字列に直面する全てのユーザの ... gettext_lazy as _ class AuthorForm ( ModelForm ): class Meta : model = Author fields = [ "name" , "title" , "birth_date" ] labels = { "name" : _ ( "Writer" ), } help_texts = { "name" : _ ( "Some useful help text." ), } error_messages = { "name" : { "ma ... 2026年10月08日