'inline_formset auto_id starting from a custom number

Django user here.

I want my first fields in my inline formsets start from a custom number, like 7 for example :

<input type="text" name="prescriptiondetails-7-unit" maxlength="100" class=" form-control-sm  form-control " id="id_prescriptiondetails-7-unit" value="">
<input type="text" name="prescriptiondetails-7-sqf" maxlength="100" class=" form-control-sm  form-control " id="id_prescriptiondetails-7-sqf" value="">
...

here my view

class add_prescriptiondetail_field_form_hx(AddMixin_hx):
    model = Prescription
    form_class = PrescriptionForm
    success_url = reverse_lazy('prescriptions:list_prescription')
    template_name = __name__.split(".")[-2] + '/' + 'prescriptiondetail_field_hx.html'

    wire_dict = wire_dict_init

    def get_context_data(self, *args, **kwargs):
        context = super().get_context_data(*args, **kwargs)

        formset_prefix = 'prescriptiondetails'
        context['formset_prefix'] = formset_prefix

        from django.forms.formsets import INITIAL_FORM_COUNT

 
        from .forms import PrescriptionDetailForm
        from .models import PrescriptionDetail
        form_set = PrescriptionDetailFormSet = inlineformset_factory(Prescription, PrescriptionDetail, 
                                            form=PrescriptionDetailForm, 
                                            fields = ['unit', 'sqf'], 
                                            extra=0,
                                            max_num=10, min_num=1,
                                            
                                            can_delete=True
        )
        
        
        context['prescriptiondetail'] = form_set
        #           
        return context

how can I tell django to start from count 7 and not render the form fields id and names from 0

NB : Not interested in JS solutions.

I've been pulling my hair for a whole day, read the doc in and out ... but without luck

thank you guys



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source