1👍
✅
It happens because you set id
as non-editable. At the same time, model_to_dict
returns a dictionary suitable for passing as a Form’s initial
keyword argument.
You can easily check the source code of model_to_dict
, and see that fields with such attribute set are skipped. Check this Convert Django Model object to dict with all of the fields intact it might be helpfull.
Source:stackexchange.com