... initial から取得し、それ以外の場合は Field.initial を参照します。呼び出し可能な値は評価されます。 It is recommended to use BoundField.initial over get_initial_for_field() because BoundField.initial has a simpler interface. Also, unlike get_initial_for_fiel ... d() , BoundField.initial caches its values. This is useful especially when dealing with callables whose return values can change (e.g. date ... t_initial_for_field ( f . fields [ "identifier" ], "identifier" ) UUID('1b411fab-844e-4dec-bd4f-e9b0495f04d0') >>> # Using BoundField.initial, for comparison >>> f [ "identifier" ] . initial UUID('28a09c59-5f00-4ed9-9179-a3b074fa9c30') >>> f [ "identifier" ... ... initial から取得し、それ以外の場合は Field.initial を参照します。呼び出し可能な値は評価されます。 It is recommended to use BoundField.initial over get_initial_for_field() because BoundField.initial has a simpler interface. Also, unlike get_initial_for_fiel ... d() , BoundField.initial caches its values. This is useful especially when dealing with callables whose return values can change (e.g. date ... t_initial_for_field ( f . fields [ "identifier" ], "identifier" ) UUID('1b411fab-844e-4dec-bd4f-e9b0495f04d0') >>> # Using BoundField.initial, for comparison >>> f [ "identifier" ] . initial UUID('28a09c59-5f00-4ed9-9179-a3b074fa9c30') >>> f [ "identifier" ... ... l のメソッド) aremove() (RelatedManager のメソッド) arg_joiner (Func の属性) args (ResolverMatch の属性) aria_describedby (BoundField の属性) arity (Func の属性) ArrayAgg (django.contrib.postgres.aggregates のクラス) ArrayField (django.contrib.postgres.fie ... () (Field のメソッド) as_div() (BaseFormSet のメソッド) (Form のメソッド) as_double() (Field のメソッド) as_field_group() (BoundField のメソッド) as_hidden() (BoundField のメソッド) as_int() (Field のメソッド) as_json() (Form.errors のメソッド) as_manager( ... ッド) as_vendorname() (django.db.models モジュール) as_view() (django.views.generic.base.View のクラスメソッド) as_widget() (BoundField のメソッド) asave() (Model のメソッド) asc() (Expression のメソッド) asend() (Signal のメソッド) asend_robust() (Signal の ... ... l のメソッド) aremove() (RelatedManager のメソッド) arg_joiner (Func の属性) args (ResolverMatch の属性) aria_describedby (BoundField の属性) arity (Func の属性) ArrayAgg (django.contrib.postgres.aggregates のクラス) ArrayField (django.contrib.postgres.fie ... () (Field のメソッド) as_div() (BaseFormSet のメソッド) (Form のメソッド) as_double() (Field のメソッド) as_field_group() (BoundField のメソッド) as_hidden() (BoundField のメソッド) as_int() (Field のメソッド) as_json() (Form.errors のメソッド) as_manager( ... ッド) as_vendorname() (django.db.models モジュール) as_view() (django.views.generic.base.View のクラスメソッド) as_widget() (BoundField のメソッド) asave() (Model のメソッド) asc() (Expression のメソッド) asend() (Signal のメソッド) asend_robust() (Signal の ... ... ) version = models . IntegerField () name = models . CharField ( max_length = 20 ) 詳細は 複合主キー を参照してください。 BoundField のオーバーライドの簡素化 ¶ Prior to version 5.2, overriding Field.get_bound_field() was the only option to use a custom Bo ... nderer.bound_field_class フォーム層で Form.bound_field_class フィールド層で Field.bound_field_class 例えば、 Form クラスの BoundField をカスタマイズするには、下記のように実装します。 from django import forms class CustomBoundField ( forms . BoundField ): c ... ult += f " { self . custom_class } " return result . strip () class CustomForm ( forms . Form ): bound_field_class = CustomBoundField name = forms . CharField ( label = "Your Name" , max_length = 100 , required = False , widget = forms . TextInput ( attrs ... ... ) version = models . IntegerField () name = models . CharField ( max_length = 20 ) 詳細は 複合主キー を参照してください。 BoundField のオーバーライドの簡素化 ¶ Prior to version 5.2, overriding Field.get_bound_field() was the only option to use a custom Bo ... nderer.bound_field_class フォーム層で Form.bound_field_class フィールド層で Field.bound_field_class 例えば、 Form クラスの BoundField をカスタマイズするには、下記のように実装します。 from django import forms class CustomBoundField ( forms . BoundField ): c ... ult += f " { self . custom_class } " return result . strip () class CustomForm ( forms . Form ): bound_field_class = CustomBoundField name = forms . CharField ( label = "Your Name" , max_length = 100 , required = False , widget = forms . TextInput ( attrs ... ... 使用するテンプレートのデフォルト名。 デフォルトは "django/forms/formsets/div.html" テンプレートです。 field_template_name ¶ BoundField をレンダリングするために使用されるテンプレートのデフォルト名。 デフォルトは "django/forms/field.html" です。 bound_field_c ... lass ¶ プロジェクト全体でフォームフィールドを表現するために使用されるデフォルトのクラスです。 BoundField クラスのデフォルト。 このデフォルトクラスは、フォームごとに Form.bound_field_class を、フィールドごとに Field.bound_field_ ... ールド関連または非表示フィールド関連の全エラー。 フィールドテンプレートで利用可能なコンテキスト ¶ フィールドテンプレートは、 BoundField.get_context() からコンテキストを受け取ります。デフォルトでは、フィールドは以下の値を含む辞書を受け取ります: field : BoundF ... ... 使用するテンプレートのデフォルト名。 デフォルトは "django/forms/formsets/div.html" テンプレートです。 field_template_name ¶ BoundField をレンダリングするために使用されるテンプレートのデフォルト名。 デフォルトは "django/forms/field.html" です。 bound_field_c ... lass ¶ プロジェクト全体でフォームフィールドを表現するために使用されるデフォルトのクラスです。 BoundField クラスのデフォルト。 このデフォルトクラスは、フォームごとに Form.bound_field_class を、フィールドごとに Field.bound_field_ ... ールド関連または非表示フィールド関連の全エラー。 フィールドテンプレートで利用可能なコンテキスト ¶ フィールドテンプレートは、 BoundField.get_context() からコンテキストを受け取ります。デフォルトでは、フィールドは以下の値を含む辞書を受け取ります: field : BoundF ... ... ccessed by overriding bound_field_class or override Field.get_bound_field() if you need more flexibility when creating the BoundField : Field. get_bound_field ( form , field_name ) [ソース] ¶ Form のインスタンスとフィールド名を引数に取り、対応する BoundFie ... ld インスタンスを返します。この返された BoundField は、テンプレート内でそのフィールドにアクセスする際に使用されます。 BoundField をオーバーライドする例は、 BoundField のカス ... ... a datetime value. MultiWidget.widgets now accepts a dictionary which allows customizing subwidget name attributes. The new BoundField.widget_type property can be used to dynamically adjust form rendering based upon the widget type. 国際化 (internationaliza ... xist in django.db.models.fields is removed. The compatibility imports of django.forms.utils.pretty_name() and django.forms.boundfield.BoundField in django.forms.forms are removed. The compatibility imports of Context , ContextPopException , and RequestCont ... 2026年10月08日