Closed timgraham closed 1 month ago
Hrm, why should this silently accept an int conversion on the autofield? I understand that uncoerced data comes through the form construction, but wouldn't this be breaking assumptions on ObjectId types?
This is a continuation of https://github.com/mongodb-labs/django-mongodb/pull/105#discussion_r1719170263.
Ahhhh, thanks for the reminder.
Now that it's called "ObjectIdAutoField" rather than "MongoAutoField" I imagine this could lead to some confusion. Nonetheless, let's add the change in, but could you add a comment above including this ticket? https://jira.mongodb.org/browse/INTPYTHON-393
I don't think it's an issue now, nor is this a bad solution. I would want to revisit the semantics of this at a later date.
There are at least two places in Django where
Field.to_python()
processes uncoerced form data,BaseModelFormSet._construct_form()
andModelAdmin.get_object()
.