Skip to content

Instantly share code, notes, and snippets.

@hancush
Last active January 10, 2018 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hancush/72261ec42bf29054350261917b26b381 to your computer and use it in GitHub Desktop.
Save hancush/72261ec42bf29054350261917b26b381 to your computer and use it in GitHub Desktop.
from make_a_formset import formset
# populate your formset
for form in formset:
form_data = form.clean_data
# {'name': 'Hannah', 'favorite_color': 'yellow'}
# do stuff with the data
from django import forms
from django.forms import formset_factory
# Make your form
class PersonForm(forms.Form):
name = forms.CharField()
favorite_color = forms.CharField()
# Make your formset factory
PeopleFormSet = formset_factory(PersonForm)
# Instantate your formset
formset = PeopleFormSet()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment