Fix Django exceptions when lists (eg. distro/profiles) are empty.
Merge pull request #1019 from jmaas/master

Fix Django exceptions when lists (eg. distro/profiles) are empty.