Skip to content
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

Kwargs should contain 'queryset' when child is a FormSet on edition #48

Open
decolens opened this issue Jul 26, 2017 · 1 comment
Open

Comments

@decolens
Copy link

When using MultiForm for editing models (= putting 'instance' in the kwargs), if one or several of the forms contained inside the MultiForm are FormSet, a TypeError with message "init() got an unexpected keyword argument 'instance'" is raised.
I think this error is due to the "fkwargs = kwargs.copy()" line in the "get_form_args_kwargs" method of multiform.py. If the MultiForm kwargs are copied for any of the child, they will all contain the 'instance' argument, instead of the 'queryset' needed for FormSet.

@decolens
Copy link
Author

I have added a possible fix for this bug. See lines 184-187 in get_form_args_kwargs of MultiModelForm. For that to work I needed to add "from django.db.models.query import QuerySet" (see line 18 in the imports)
multiform_master.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant