Trying to pass a QuerySet as initial data to a formset

后端 未结 2 1816
天命终不由人
天命终不由人 2020-12-30 06:56

I\'m trying to build a page for an inventory system that will allow a user to update a quantity of items received.

I want to show a table of all products and let t

2条回答
  •  执笔经年
    2020-12-30 07:29

    You can also use the queryset argument. This should work:

    formset = ShipmentFormSet(queryset=list_of_active_products)

    cf. https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#changing-the-queryset

提交回复
热议问题