mrjoes/flask-admin — pull request #218 by mostafar (2013-04-28 07:10:28+00:00)
Title: A bug occurred in get_one, solved in this change.

Casting to ObjectId when the database is using ObjectId as type of _id is mandatory, because usual type of _id field in wtf is StringField, so it should be converted to ObjectId in queries.
The best solution to support ObjectId and other types for _id is to try to convert given _id to ObjectId, if it was successful so we can put the ObjectId in query, otherwise we can put the original given _id to query (So the developer will be responsible for it's type matching).
I changed the code and tested it in various cases.