Denormalized ForeignKeys fixed

Foreign keys should return an ID, but the denormalization function returns an object,
which should be set to the `self.name` attribute, rather than to `self.attname`;
and *then*, later, return `self.attname` attribute (this will effectively return the FK's PK).

Setting `self.attname` to `None` first is an optimization so the database is not hit in case
`self.name` attribute already has a value that is being overwritten.