Passing an instance to a Django formset

How to pass an instance to a Django formset, The script is as follows. I updated several lines using a set of forms, and at a later stage I need to edit the values ​​that I added earlier. (Editing)

q=PaymentLines.objects.filter(pay_lines=project) formset = PayFormSet(prefix='payment',instance=q) 
+6
source share
2 answers
+3
source

I used it like this: inlineformset_factory .

 q = Projects.objects.get(pk=project) formset = PayFormSet(prefix='payment',instance=q) 

and then pass the form template to the template

+2
source

Source: https://habr.com/ru/post/921379/


All Articles