A formset in Django is a layer of abstraction to work with multiple forms on the same page.
Questions tagged [formsets]
97 questions
22
votes
5 answers
How would you make a dynamic formset in Django?
Here's the way I'm doing it:
{{ formset.management_form }}
{% for form in formset.forms %}
{{ form }}
{% endfor %}
Add Form
And here's the JS:
var form_count =…

mpen
- 272,448
- 266
- 850
- 1,236
18
votes
2 answers
Trying to pass a QuerySet as initial data to a formset
I'm trying to build a page for an inventory system that will allow a user to update a quantity of items received.
I want to show a table of all products and let the user enter the quantity received, which I'll post and iterate over to update the…

Shawn Inman
- 331
- 1
- 3
- 8
11
votes
1 answer
Django 'ManagementForm data is missing or has been tampered with' when saving modelForms with foreign key link
I am rather new to Django so this may be an easy question. I have 2 modelForms where there is a ForeignKey to another. My main goal is to save Indicators with a link to Disease (FK), such that for a particular disease, you can have multiple…

nlr25
- 1,605
- 5
- 17
- 27
10
votes
3 answers
how to submit a form and formset at the same time
I am trying to render a form and a formset at once.
The formset is working fine (i think), but the form is not validating (as if there was no data being posted)
i have tried playing with the button but its main submit function comes through js.
the…

rafirosenberg
- 333
- 3
- 9
9
votes
5 answers
Paginate Django formset
I have a model formset that I want to display 10 forms at a time using Django's Paginator, but it can't be done like paginator = Paginator(formset, 10). What's the correct way to do this, if there is a way?

Aylen
- 3,524
- 26
- 36
7
votes
2 answers
Non Form Errors for a Formset not Rendering with Django Crispy Forms
I implement a custom clean method to validate my formset. I know there are error as I can print them to the console but these non_form_errors() are never rendered in my template. How can I render them?
template.html:
5
votes
3 answers
Save a formset of custom forms django
I am trying to save a formset in django.
To do so I have my model and a customized form.
Then I create my formset this way :
QuoteFormSet = formset_factory(QuoteForm, extra=2)
formset = QuoteFormset(request.POST)
But when I do formset.save() i get…

maazza
- 7,016
- 15
- 63
- 96
4
votes
1 answer
Are custom-written grouped UITableViews really the way to implement standard forms on iOS?
What is this about
I notice many many apps I use have a similar way of implementing form (sets). For example:
This is basically the same scheme used in the Settings app as well.
My problem
When I need to make something like this, I basically make…
user188041
4
votes
1 answer
Django: prevent saving empty form in formset
this should be a fairly easy one, but I am really struggling to figure it out by my self.
I am doing a real estate app and I need my users to be able to upload their images of houses. Each image is related to a House and each House is related to a…

A Campos
- 753
- 3
- 10
- 31
4
votes
0 answers
Django : Error : [u'ManagementForm data is missing or has been tampered with'] after formset is saved
After I press the submit button for a formset being saved, I get this error:
"[u'ManagementForm data is missing or has been tampered with']"
This is the code in my views.py
MarcheFormSet = formset_factory(PrixMarcheForm1, extra=2)
if request.method…

Ramsey Harrison
- 63
- 1
- 6
4
votes
2 answers
Alter fields in Django formset using clean
How do you alter fields in each form of a Django formset using the clean method?
class MyInlineFormSet(BaseInlineFormSet):
def clean(self):
if self.cleaned_data['inputted'] == self.cleaned_data['answer']:
…

ssomnoremac
- 729
- 1
- 8
- 16
3
votes
0 answers
Django inline formset custom validation
Okay. I am probably just overlooking something silly. But I am having an issue with an inline form in django. I have this:
class BaseModelAFormset(forms.models.BaseInlineFormSet):
def clean(self):
for form in self.forms:
…

lovefaithswing
- 1,510
- 1
- 21
- 37
3
votes
1 answer
Why does min_num in Django formsets lead to n+1 formset being rendered
In Django formsets (v. 1.9), there is an option min_num in the formset_factory function which specifies the minimum number of forms in the formset.
A view might look like this:
class ExampleForm(forms.Form):
msg = forms.CharField()
ExFormSet =…

Jarno
- 6,243
- 3
- 42
- 57
3
votes
1 answer
How to pass a queryset for each different field Admin Inlines
Pretend to have in the Django admin, 4 forms inlines, Each with a pair of fields choices, "Attributes" and "Value Option". We have the first pair, which initialize the field one with a value, for example color and other field you must have a…

Colpaisa
- 355
- 1
- 4
- 14
3
votes
1 answer
MultiValueDictKeyError django formset
I am trying to post data from a formset and I get a MultiValueDictKeyError
View
from django.forms.models import modelformset_factory
BetFormset = modelformset_factory(Bet, form=Bets, extra=0, max_num=1)
if…

amchugh89
- 1,276
- 1
- 14
- 33