Fixed #10811 -- Assigning unsaved objects to FK raises ValueError

Thanks @timgraham  for help