1👍
I ended up using a workaround as suggested by ‘mastazi’ for passing this id as a hidden field.
All I did is access this hidden field and generate it as an html element. Since I am using crispy_forms layout I was able to use an HTML element under Layout.
form_id= self.instance.id
id_hidden = '<input type="hidden" id="form_id" value=' + str(form_id) +' />'
I am not sure if this is a perfect solution but it works.
Source:stackexchange.com