Deleting the correct related object on cascade when deleting a class that inherits a GenericRelation

a fix for https://code.djangoproject.com/ticket/19149