You can also use the queryset argument. This should work:
formset = ShipmentFormSet(queryset=list_of_active_products)
From the docs it looks like you have to pass in a list of dictionaries as the initial data, rather than a QuerySet:
Also note that we are passing in a list of dictionaries as the initial data.
You may want to change your initial query to:
list_of_active_products = Product.objects.filter(status=1).values()
which will return a list of dictionaries rather than model-instance objects.
Using initial data with a formset:
- How to specify long url patterns using Regex so that they follow PEP8 guidelines
- How does use_for_related_fields work in Django?
- Django queryset __contains case sensitive?
- Django + Forms: Dynamic choices for ChoiceField