-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FormCollection self.instance bug due to FormCollection.full_clean() #159
Comments
Replicated: How to test:
Notes: Why is this important:
How I stumbled upon this issue
class CompanyDepartmentUpdateView(SingleObjectMixin, FormCollectionView):
model = Company
collection_class = CompanyDepartmentFormset
def form_collection_valid(self, form_collection):
form_collection.save()
class FormCollection(FormCollection):
department_formset = DepartmentForm()
def save(self):
for department_kwargs in self.cleaned_data['department_formset']:
Department.objects.create(company=self.instance, **deparment_kwargs) |
Thanks for creating a runnable demo, appreciate that. I'll have a look at it. |
Sure thing! I really love using your library and happy to help on improving on it! |
Given
Expectation:
self.instance.name
should consistently be the parent_object.name passed inFormCollectionView.get_form_kwargs()
Actual Results:
self.instance.name
would refer to the last object child.name afterFormCollection.full_clean()
Observations:
Note:
I'll to replicate this in django-formset using the repo. I'll get back to you on this as I'm swamped at the moment.
The text was updated successfully, but these errors were encountered: