Skip to content

Addons: manage single version projects #10686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions readthedocs/proxito/views/hosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,21 @@ def _v0(self, project, version, build, filename):
It tries to follow some similarity with the APIv3 for already-known resources
(Project, Version, Build, etc).
"""
versions_active_built_not_hidden = (
Version.internal.public(project=project, only_active=True, only_built=True)
.exclude(hidden=True)
.only("slug")
.order_by("slug")
)
version_downloads = []
versions_active_built_not_hidden = Version.objects.none()

if not project.single_version:
versions_active_built_not_hidden = (
Version.internal.public(
project=project, only_active=True, only_built=True
)
.exclude(hidden=True)
.only("slug")
.order_by("slug")
)
if version:
version_downloads = version.get_downloads(pretty=True).items()

project_translations = (
project.translations.all().only("language").order_by("language")
)
Expand Down Expand Up @@ -283,7 +292,7 @@ def _v0(self, project, version, build, filename):
"name": name,
"url": url,
}
for name, url in version.get_downloads(pretty=True).items()
for name, url in version_downloads
],
# TODO: find a way to get this data in a reliably way.
# We don't have a simple way to map a URL to a file in the repository.
Expand Down