Adds support for Model classes as keys

If a Model class "B" is the key of a single-item dictionary configuring
model "A", B's own relationships will be examined to find the one that
traces back to the parent model A.  The field name (such as
"A.thefield") will automatically be detected.
Adds support for generic fk