Change queryset of inlineformset_factory [django-extra-views] -


I am using dozens of additional scenes. How do I change the query set in the form in the product field? ? My following code works just fine. But it seems dirty to me, is there a better solution? FormSetView, ModelFormSetView class MyCreateView (ModelFormSetView): Model = MyModel def construct_formset (self) from import_steps: i = 0 inline_formsets = super (MyCreateView, itself) .form_setset for formset () Inline_formsets : Inline_formsets [i]. Fields ['product']. Queryset = Product.blog.filters (site = GetActiveSite (auto request)) i + = 1 return inline_format

I was able to complete it without using the iterator:

  ... def construct_formset (self): formsets = super (MyCreateView, itself) formets in formets .construct_formset () for: formset.fields ['product']. Queryset = Product. FileFileer (site = GetActiveSite (self.request)) Return FormSet  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -