I've declared a formset like so:
class BaseFeatureFormSet(BaseFormSet):
def save(self, commit = True):
feature = Feature(name = self.cleaned_data['name'],
type = self.cleaned_data['type'],
premium = self.cleaned_data['premium'],)
feature.save()
return feature
FeaturesFormset = formset_factory(EditFeatureForm,
formset = BaseFeatureFormSet, extra = 0)
So when I'm saving the formset, I'm getting a TypeError: list indices must be integers, not str
referring to the first line of the save()
function. How do I solve this error?
Update 1
Managed to solve this first bit thanks to gruszyczy. I'm not getting another TypeError: 'EditFeatureFormFormSet' object is not iterable
from the next line in the code section:
for feature in features:
feature.save()
feature = vehicle.features.add(feature)
The error is from for feature in features:
Ideas?