[Answer]-Edit related object using ModelFormSet

1👍

with model formsets, the initial values only apply to extra forms, those that aren’t bound to an existing object instance.
Django docs

The queryset provides the selected/entered values for the bound fields, the initial for the extra fields (in your case 0).

But you can override the initial value in e.g. your views when you created a field called employee in this case:

for form in forms:
    # Don't override a selected value.
    if not form.fields['employee'].initial:
        form.fields['employee'].initial = my_init
👤yofee

Leave a comment