Use hasattr to see if a foreign key exists

All tests pass.