Open radzhome opened 6 years ago
This might be related to when a model coming from an ArrayModelField
is changed.. I'm ending up getting an FieldDoesNotExist
because I changed a model that is I use as ArrayModelField
, even tho I have ENFORCE_SCHEMA
to False
One line description of the issue
ENFORCE_SCHEMA does not work with inconsistent data types
Python script
Say your model looks something like this
You create an instance of it in admin and all is good. In mongo the
some_date
field is saved as"some_date" : ISODate("2018-07-17T16:18:04.503Z")
. Now lets change this to a string in the db,"some_date" : "2018-07-17T16:18:04.503Z"
. When you try to open this now in admin, there is an error. ENFORCE_SCHEMA works great if the data is completely missing, but what about cases where its the wrong type? Would be nice to allow some data casting on the model if its not in the matching data type. I'm trying to do this with middleware but no luck yet.Traceback