Make related_policy_ids method more robust

Two things this method was doing wrong:

  * It was returning non-policies
  * It fell over if the related document had been deleted
Merge pull request #1765 from alphagov/fix-related_policy_ids

Make related_policy_ids method more robust