1👍
✅
The problem is your WorkerStatusFormSet.__init__
method. Looking at the code for BaseModelFormSet
, the __init__
method already takes a queryset parameter. Since you aren’t doing anything in your __init__
method except calling super()
, the easiest fix is to remove it.
It’s not a good idea to change the signature of the __init__
method as you have done for two reasons
def __init__(self, queryset, *args, **kwargs):
super(WorkerStatusFormSet, self).__init__(*args, **kwargs)
- You have changed the order of the arguments. If you look at the code for
BaseModelFormset
, the first argument is data. That means that data might be incorrectly assigned to queryset if somebody calls WorkerStatusFormSet(data, …) - You do not do anything with
queryset
or pass it tosuper()
, so it is lost.
Source:stackexchange.com