Reply to comment


Dec. 8, 2022, 1:39 a.m. -  Dcr

Thanks for this, very very helpful. On the ProductUpdate view, what if i want to apply filter so that the items displayed on the formset are based not only the 'pk' value but also on another condition. For example, a unique string used as a reference number. So that the url path would look like: path('update/<int:pk>/<str:ref_number>', ProductUpdate.as_view(), name='update_product') I added <str:ref_number>, which allows me to filter all items that contain that ref_number, not just filter by the 'pk'. What should the value 'instance' be in the VariantFormSet below: 'variants': VariantFormSet(self.request.POST or None, self.request.FILES or None, instance=???, prefix='variants') ?

Post your comment

Required for comment verification