... たいと思うかもしれません。 ArticleForm からフォームセットを作るには、次のようにします: >>> from django.forms import formset_factory >>> ArticleFormSet = formset_factory ( ArticleForm ) これで ArticleFormSet という名前のフォームセットクラスが作成されました ... のフォームがひとつだけ表示されました。表示される空のフォームの数は extra パラメータで制御できます。デフォルトでは、 formset_factory() は空のフォームを1つ定義します。次の例では、フォームセットクラスを作成して空のフォームを2つ表示します: >>> ArticleFormSet ... = formset_factory ( ArticleForm , extra = 2 ) Formsets can be iterated and indexed, accessing forms in the order they were created. You can ... ... { "headline" : "Initial headline" }, instance = article ) >>> form [ "headline" ] . value () 'Initial headline' ModelForm factory 関数 クラス定義ではなく、スタンドアロン関数 modelform_factory() を使って、与えられたモデルからフォームを作成することもでき ... ます。あまりカスタマイズをしないなら、こちらの方が便利でしょう: >>> from django.forms import modelform_factory >>> from myapp.models import Book >>> BookForm = modelform_factory ( Book , fields = [ "author" , "title" ]) これは既存のフ ... とえば、指定されたフィールドに使用するウィジェットを指定できます: >>> from django.forms import Textarea >>> Form = modelform_factory ( Book , form = BookForm , widgets = { "title" : Textarea ()}) 含むフィールドは fields や exclude のキーワード引数、もしく ... ... フィールドの django.db.models.Field 型に対応するデフォルトウィジェットを適用します。 モデルフォームファクトリ関数 modelform_factory modelform_factory ( model , form = ModelForm , fields = None , exclude = None , formfield_callback = None , widgets = None ... す。 field_classes は、フォームフィールドクラスにマッピングされたモデルフィールド名のディクショナリです。 使用例は ModelForm factory 関数 を参照してください。 フィールドのリストは、キーワード引数 fields や exclude 、もしくはフォームの内部の Meta クラスで対 ... ドを選択する を参照してください。使うフィールドの定義を省略すると、 ImproperlyConfigured 例外を引き起こします。 modelformset_factory modelformset_factory ( model , form = ModelForm , formfield_callback = None , formset = BaseModelFormSet , extra = 1 , can ... ... ... hers is increased from 71 to 128 bits. django.contrib.contenttypes The new absolute_max argument for generic_inlineformset_factory() allows customizing the maximum number of forms that can be instantiated when supplying POST data. See インスタンス化でき ... るフォームの数を制限する for more details. The new can_delete_extra argument for generic_inlineformset_factory() allows removal of the option to delete extra forms. See can_delete_extra for more information. django.contrib.gis The GD ... dler.upload_interrupted() callback allows handling interrupted uploads. フォーム The new absolute_max argument for formset_factory() , inlineformset_factory() , and modelformset_factory() allows customizing the maximum number of forms that can be instan ... ... 記を提供します: BaseGenericInlineFormSet GenericForeignKey を使用するためのフォームセットファクトリ、 generic_inlineformset_factory() 。 class BaseGenericInlineFormSet [ソース] generic_inlineformset_factory ( model , form = ModelForm , formset = BaseGene ... del = True , min_num = None , validate_min = False , absolute_max = None , can_delete_extra = True ) [ソース] modelformset_factory() を使用して GenericInlineFormSet を返します。 デフォルトの content_type と object_id と異なる場合は、それぞれ ct_field と ... fk_field を指定する必要があります。その他のパラメータは modelformset_factory() と inlineformset_factory() で説明されているものと同様です。 for_concrete_model 引数は GenericForeignKey の for_concrete_ ... ... ets have a strictly-enforced maximum number of forms (1000 by default, though it can be set higher via the max_num formset factory argument). Admin history view information leakage In previous versions of Django, an admin user without change permission ... ... ets have a strictly-enforced maximum number of forms (1000 by default, though it can be set higher via the max_num formset factory argument). Admin history view information leakage In previous versions of Django, an admin user without change permission ... ... ィールドの作成 モデルフォーム モデルフォームの Meta API モデルフォームファクトリ関数 フォームセット (Formset) の関数 formset_factory フォームレンダリング API 低レベルのレンダリングAPI 組み込みのテンプレートフォームレンダラー フォームセットテンプレートで利 ... ... to pass initial values to the model forms that are part of both model formsets and inline model formsets as returned from factory functions modelformset_factory and inlineformset_factory respectively just like with regular formsets. However, initial va ... 2026年10月08日