If you follow the link to the datasheet from your link, you will see that the overall length of the battery holder is a little longer than 2 D cells. That holder is sized to have two D cells in each slot, for a total of 4 cells in series.
Be aware: The total voltage from you pack will vary due to type of cells used, and their state of charge. Make sure that whatever you are powering will work properly over that range of voltage. Otherwise, you will need some sort of voltage regulator.