'Get the default version (slug).
Returns self.default_version if the version with that slug actually
exists (is built and published). Otherwise returns \'latest\'.'

def get_default_version(self):

    if (self.default_version == LATEST):
        return self.default_version
    version_qs = self.versions.filter(slug=self.default_version, active=True)
    if version_qs.exists():
        return self.default_version
    return LATEST
