Fix error when trying to delete nonexisting related attribute

An error would happen when trying to access the reverse of a foreign key relationship which had not been created. This fixes it. Cheers.