... の異なる入力タイプを使用するために、 'type' 属性を指定することも可能です。これを行うには、ウィジェットを作成する際に Widget.attrs 引数を使用します。 class CommentForm ( forms . Form ): name = forms . CharField ( widget = forms . TextInput ( attrs = { " ... class" : "special" })) url = forms . URLField () comment = forms . CharField ( widget = forms . TextInput ( attrs = { "size" : "40" })) フォーム定義内でウィジェットを変更することもできます: class CommentForm ( forms . Form ): name = for ... ms . CharField () url = forms . URLField () comment = forms . CharField () name . widget . attrs . update ({ "class" : "special" }) comment . widget . attrs . update ( size = "40" ) あるいは、フォームに直接フィールドが宣 ... ... の異なる入力タイプを使用するために、 'type' 属性を指定することも可能です。これを行うには、ウィジェットを作成する際に Widget.attrs 引数を使用します。 class CommentForm ( forms . Form ): name = forms . CharField ( widget = forms . TextInput ( attrs = { " ... class" : "special" })) url = forms . URLField () comment = forms . CharField ( widget = forms . TextInput ( attrs = { "size" : "40" })) フォーム定義内でウィジェットを変更することもできます: class CommentForm ( forms . Form ): name = for ... ms . CharField () url = forms . URLField () comment = forms . CharField () name . widget . attrs . update ({ "class" : "special" }) comment . widget . attrs . update ( size = "40" ) あるいは、フォームに直接フィールドが宣 ... ... "subject" ] . legend_tag () <legend class="required" for="id_subject">Subject:</legend> >>> f [ "subject" ] . label_tag ( attrs = { "class" : "foo" }) <label for="id_subject" class="foo required">Subject:</label> >>> f [ "subject" ] . legend_tag ( at ... ース] ¶ フィールドをそのヘルプテキストやエラーメッセージと関連付けるための aria-describedby 参照を返します。ただし、 Widget.attrs に aria-describedby がすでに設定されている場合は、ユーザー定義の属性を保持するために None を返します。 BoundField. auto_id ... ォルトでは、これはフィールドの名前に id_ を前につけたものになります(上の例では " id_my_field ")。フィールドのウィジェットの attrs を設定することで、IDを変更できます。例えば、以下のようにフィールドを宣言します: my_field = forms . CharField ( widget = fo ... ... "subject" ] . legend_tag () <legend class="required" for="id_subject">Subject:</legend> >>> f [ "subject" ] . label_tag ( attrs = { "class" : "foo" }) <label for="id_subject" class="foo required">Subject:</label> >>> f [ "subject" ] . legend_tag ( at ... ース] ¶ フィールドをそのヘルプテキストやエラーメッセージと関連付けるための aria-describedby 参照を返します。ただし、 Widget.attrs に aria-describedby がすでに設定されている場合は、ユーザー定義の属性を保持するために None を返します。 BoundField. auto_id ... ォルトでは、これはフィールドの名前に id_ を前につけたものになります(上の例では " id_my_field ")。フィールドのウィジェットの attrs を設定することで、IDを変更できます。例えば、以下のようにフィールドを宣言します: my_field = forms . CharField ( widget = fo ... ... 削除されました。 IPython 1.0 未満へのサポートが shell コマンドから削除されました。 The signature of private API Widget.build_attrs() changed from extra_attrs=None, **kwargs to base_attrs, extra_attrs=None . File-like objects (e.g., StringIO and BytesIO ... ... 削除されました。 IPython 1.0 未満へのサポートが shell コマンドから削除されました。 The signature of private API Widget.build_attrs() changed from extra_attrs=None, **kwargs to base_attrs, extra_attrs=None . File-like objects (e.g., StringIO and BytesIO ... ... n particular, when the login page is accessed directly) ( #28229 ). Prevented attribute values in the django/forms/widgets/attrs.html template from being localized so that numeric attributes (e.g. max and min ) of NumberInput work correctly ( #28303 ) ... ... n particular, when the login page is accessed directly) ( #28229 ). Prevented attribute values in the django/forms/widgets/attrs.html template from being localized so that numeric attributes (e.g. max and min ) of NumberInput work correctly ( #28303 ) ... ... tance . some_attribute , new_instance . some_attribute ) データベースのカラム定義に影響しないフィールド属性 ¶ Field.non_db_attrs をオーバーライドすることで、カラム定義に影響しないフィールドの属性をカスタマイズできます。これはモデルのマイグレーションの ... 間に使われ、no-opの AlterField 操作を検出します。 例えば: class CommaSepField ( models . Field ): @property def non_db_attrs ( self ): return super () . non_db_attrs + ( "separator" ,) カスタムフィールドのベースクラスを変更する ¶ カスタムフィールド ... ... ードジェネレーターの実装を次のように始めることができます: class iTunesFeed ( Rss201rev2Feed ): def root_attributes ( self ): attrs = super () . root_attributes () attrs [ "xmlns:itunes" ] = "http://www.itunes.com/dtds/podcast-1.0.dtd" return attrs def a ... 2026年10月08日