Fixed #10811 -- Assigning unsaved objects to FK, O2O and GFK raises ValueError.

Thanks @timgraham @loic  for help and reviewing.