Open sumitbindra opened 4 years ago
I have looked at this in more detail and when there is an ID auto field in there instead of custom primary key, the forms errors out when you try to pre-populate it with data from an instance.
I think the issue is more general with pre-populating forms.
I am using DAL to provide a selectable dropdown list like this:
Note here that occupation_code is my PK while I am using str to show occupation_title as my display. Mostly everything works fine but then I use instance to prepopulate the form, the title is not displayed. The form field is empty. I have other similar models where the PK is the same as display and those work just fine. So I am pretty sure there is something I am missing here.
Here is my DAL view:
Here is my form:
And here is what I see:
https://drive.google.com/file/d/13651JtB_1f7VJWgGsXeJSTm1l7B-xA-b/view?usp=sharing
Any thought on why the field is empty when the primary key field is not the same as display field? Thanks.