{"payload":{"allShortcutsEnabled":false,"fileTree":{"docs/topics/forms":{"items":[{"name":"formsets.txt","path":"docs/topics/forms/formsets.txt","contentType":"file"},{"name":"index.txt","path":"docs/topics/forms/index.txt","contentType":"file"},{"name":"media.txt","path":"docs/topics/forms/media.txt","contentType":"file"},{"name":"modelforms.txt","path":"docs/topics/forms/modelforms.txt","contentType":"file"}],"totalCount":4},"docs/topics":{"items":[{"name":"db","path":"docs/topics/db","contentType":"directory"},{"name":"forms","path":"docs/topics/forms","contentType":"directory"},{"name":"http","path":"docs/topics/http","contentType":"directory"},{"name":"auth.txt","path":"docs/topics/auth.txt","contentType":"file"},{"name":"cache.txt","path":"docs/topics/cache.txt","contentType":"file"},{"name":"conditional-view-processing.txt","path":"docs/topics/conditional-view-processing.txt","contentType":"file"},{"name":"email.txt","path":"docs/topics/email.txt","contentType":"file"},{"name":"files.txt","path":"docs/topics/files.txt","contentType":"file"},{"name":"generic-views.txt","path":"docs/topics/generic-views.txt","contentType":"file"},{"name":"i18n.txt","path":"docs/topics/i18n.txt","contentType":"file"},{"name":"index.txt","path":"docs/topics/index.txt","contentType":"file"},{"name":"install.txt","path":"docs/topics/install.txt","contentType":"file"},{"name":"pagination.txt","path":"docs/topics/pagination.txt","contentType":"file"},{"name":"serialization.txt","path":"docs/topics/serialization.txt","contentType":"file"},{"name":"settings.txt","path":"docs/topics/settings.txt","contentType":"file"},{"name":"signals.txt","path":"docs/topics/signals.txt","contentType":"file"},{"name":"templates.txt","path":"docs/topics/templates.txt","contentType":"file"},{"name":"testing.txt","path":"docs/topics/testing.txt","contentType":"file"}],"totalCount":18},"docs":{"items":[{"name":"_ext","path":"docs/_ext","contentType":"directory"},{"name":"_static","path":"docs/_static","contentType":"directory"},{"name":"_templates","path":"docs/_templates","contentType":"directory"},{"name":"faq","path":"docs/faq","contentType":"directory"},{"name":"howto","path":"docs/howto","contentType":"directory"},{"name":"internals","path":"docs/internals","contentType":"directory"},{"name":"intro","path":"docs/intro","contentType":"directory"},{"name":"man","path":"docs/man","contentType":"directory"},{"name":"misc","path":"docs/misc","contentType":"directory"},{"name":"obsolete","path":"docs/obsolete","contentType":"directory"},{"name":"ref","path":"docs/ref","contentType":"directory"},{"name":"releases","path":"docs/releases","contentType":"directory"},{"name":"topics","path":"docs/topics","contentType":"directory"},{"name":"Makefile","path":"docs/Makefile","contentType":"file"},{"name":"conf.py","path":"docs/conf.py","contentType":"file"},{"name":"contents.txt","path":"docs/contents.txt","contentType":"file"},{"name":"glossary.txt","path":"docs/glossary.txt","contentType":"file"},{"name":"index.txt","path":"docs/index.txt","contentType":"file"}],"totalCount":18},"":{"items":[{"name":"django","path":"django","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"extras","path":"extras","contentType":"directory"},{"name":"scripts","path":"scripts","contentType":"directory"},{"name":"tests","path":"tests","contentType":"directory"},{"name":"AUTHORS","path":"AUTHORS","contentType":"file"},{"name":"INSTALL","path":"INSTALL","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"MANIFEST.in","path":"MANIFEST.in","contentType":"file"},{"name":"README","path":"README","contentType":"file"},{"name":"setup.cfg","path":"setup.cfg","contentType":"file"},{"name":"setup.py","path":"setup.py","contentType":"file"}],"totalCount":13}},"fileTreeProcessingTime":23.187920000000002,"foldersToFetch":[],"repo":{"id":4164482,"defaultBranch":"main","name":"django","ownerLogin":"django","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2012-04-28T02:47:18.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/27804?v=4","public":true,"private":false,"isOrgOwned":true},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"c14937cf7a1e8c25702e89485cc2dd33aa0d3a16","listCacheKey":"v0:1709542684.0","canEdit":false,"refType":"tree","currentOid":"c14937cf7a1e8c25702e89485cc2dd33aa0d3a16"},"path":"docs/topics/forms/formsets.txt","currentUser":null,"blob":{"rawLines":[".. _topics-forms-formsets:",".. _formsets:","","Formsets","========","","A formset is a layer of abstraction to working with multiple forms on the same","page. It can be best compared to a data grid. Let's say you have the following","form::",""," >>> from django import forms"," >>> class ArticleForm(forms.Form):"," ... title = forms.CharField()"," ... pub_date = forms.DateField()","","You might want to allow the user to create several articles at once. To create","a formset out of an ``ArticleForm`` you would do::",""," >>> from django.forms.formsets import formset_factory"," >>> ArticleFormSet = formset_factory(ArticleForm)","","You now have created a formset named ``ArticleFormSet``. The formset gives you","the ability to iterate over the forms in the formset and display them as you","would with a regular form::",""," >>> formset = ArticleFormSet()"," >>> for form in formset.forms:"," ... print form.as_table()","