Key "created" not found in Form
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
There's a bug in the newforms-admin code. Django uses newforms.models.form_for_instance to create forms in the admin interface. I've had errors on several fields, all of type date. I tracked down the bug, and for some reason, Django will skip over a field if it's not "editable", which I guess makes sense. The problem is that a field such as
created = models.DateTimeField(auto_now_add=True, core=True) will not be editable, even if I set editable=True.
To get around it, I changed the line
if not f.editable: in newforms.model line 116 to
if not f.editable and not f.core:. This seems to do the trick, but it should be investigated further.