You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please, which parameter or method should one use if one wants to add parameter to inline forms at runtime or not. I have tried to use the formset_kwargs and setting the form_kwargs attribute of the formset_kwargs dictionary as shown in this section of the django-extra-views docs but it was not working as expected. I obtained the following error:
Exception Type: KeyError at /creditium/inventories/product-types/add/
Exception Value: 'form_kwargs'
Here is the full traceback:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/creditium/inventories/product-types/add/
Django Version: 4.1.4
Python Version: 3.8.8
Traceback (most recent call last):
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/django/views/generic/base.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/django/views/generic/base.py", line 142, in dispatch
return handler(request, *args, **kwargs)
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/extra_views/advanced.py", line 137, in get
returnsuper().get(request, *args, **kwargs)
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/extra_views/advanced.py", line 95, in get
inlines = self.construct_inlines()
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/extra_views/advanced.py", line 79, in construct_inlines
inline_formset = inline_instance.construct_formset()
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/extra_views/advanced.py", line 31, in construct_formset
formset = super().construct_formset()
File "/home/liedji/.local/share/virtualenvs/quanta-Yd3H_Mzp/lib/python3.8/site-packages/extra_views/formsets.py", line 38, in construct_formset
returnformset_class(**self.get_formset_kwargs())
File "/home/liedji/liedji/djangoro/quanta/apps/inventories/views.py", line 315, in get_formset_kwargs
kwargs["form_kwargs"].update({"initial": {"organization": 1}})
Exception Type: KeyError at /creditium/inventories/product-types/add/
Exception Value: 'form_kwargs'
So, can we fix this to allow passing parameter to inline forms ? In addition, having a simple interface called form_kwargs et get_form_kwargs for inline forms for doing that will be more easier and more consistent for passing parameters of inline forms at runtime or not.
The text was updated successfully, but these errors were encountered:
dw-liedji
added a commit
to dw-liedji/django-extra-views
that referenced
this issue
Dec 29, 2022
Hello everyone.
Please, which parameter or method should one use if one wants to add parameter to inline forms at runtime or not. I have tried to use the
formset_kwargs
and setting theform_kwargs
attribute of theformset_kwargs
dictionary as shown in this section of the django-extra-views docs but it was not working as expected. I obtained the following error:Exception Type: KeyError at /creditium/inventories/product-types/add/ Exception Value: 'form_kwargs'
Here is the full traceback:
So, can we fix this to allow passing parameter to inline forms ? In addition, having a simple interface called
form_kwargs
etget_form_kwargs
for inline forms for doing that will be more easier and more consistent for passing parameters of inline forms at runtime or not.The text was updated successfully, but these errors were encountered: