... テキスト文字列を対応づける辞書。 指定されていないフィールドについては、 Django はモデルフィールドの help_text を適用します。 labels ModelFormOptions. labels フィールド名に対してラベル文字列を対応づける辞書。 指定されていないフィールドについては、 Django ... 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 ... ... ます。通常とは異なる方法でテストを読み込む場合は、この属性をオーバーライドします。 メソッド DiscoverRunner. run_tests ( test_labels , ** kwargs ) [ソース] テストスイートを実行します。 test_labels は実行するテストを指定するもので、いくつかのフォーマットを ... f.debug_mode (デフォルトは False ) に設定することで、テスト環境をセットアップできます。 DiscoverRunner. build_suite ( test_labels = None , ** kwargs ) [ソース] 指定されたテストラベルにマッチするテストスイートを構築(コンストラクト)します。 test_labels ... べてのテストを検索して実行します。 path/to/directory -- 指定したディレクトリ以下のすべてのテストを検索し、実行します。 test_labels の値が None の場合、テストランナーはカレントディレクトリ以下のすべてのファイルの中から、 pattern (上記参照) にマッチする名 ... ... e 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 ... ... ). With test discovery, tests can be located in any module whose name matches the pattern test*.py . In addition, the test labels provided to ./manage.py test to nominate specific tests to run must now be full Python dotted paths (or directory paths), ... Meta options. Fields included in the localized_fields list will be localized (by setting localize on the form field). The labels , help_texts and error_messages options may be used to customize the default fields, see デフォルトのフィールドをオーバライ ... ld.label_tag now includes the form's label_suffix This is consistent with how methods like Form.as_p and Form.as_ul render labels. If you manually render label_tag in your templates: {{ form.my_field.label_tag }} : {{ form.my_field }} you'll want to re ... ... 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 ... ... he --reverse option doesn't impact on --start-at or --start-after options. Moreover these options cannot be used with test labels. Running the Selenium tests Some tests require Selenium and a web browser. To run these tests, you must install the seleni ... pect which cases might be responsible for the failure, you may limit tests to be cross-analyzed by specifying further test labels after the first one: / $ ./runtests.py --pair basic.tests.ModelTest.test_eq queries transactions ...\> runtests.py --p ... ... ows defining a compatible enumeration for other concrete data types. These custom enumeration types support human-readable labels that can be translated and accessed via a property on the enumeration or its members. See Enumeration types for more detai ... the auto-generated primary key. django.contrib.admin Admin's model history change messages now prefers more readable field labels instead of field names. django.contrib.gis Support for PostGIS 2.1 is removed. Support for SpatiaLite 4.1 and 4.2 is remov ... ... go/forms/p.html" and formset_template_name to "django/forms/formsets/p.html" . The new legend_tag() allows rendering field labels in <legend> tags via the new tag argument of label_tag() . The new edit_only argument for modelformset_factory() and inlin ... ... truncation). In order to improve accessibility of the admin change forms: Form fields are now shown below their respective labels instead of next to them. Help text is now shown after the field label and before the field input. Validation errors are no ... 2026年10月08日