|
20 | 20 | from readthedocs.core.utils.general import wipe_version_via_slugs
|
21 | 21 | from readthedocs.core.resolver import resolve_path
|
22 | 22 | from readthedocs.core.symlink import PrivateSymlink, PublicSymlink
|
23 |
| -from readthedocs.core.utils import broadcast |
24 | 23 | from readthedocs.core.views.serve import _serve_file
|
25 | 24 | from readthedocs.projects.constants import PRIVATE
|
26 |
| -from readthedocs.projects.models import Project, ImportedFile |
27 |
| -from readthedocs.projects.tasks import remove_dirs |
28 |
| -from readthedocs.redirects.utils import get_redirect_response, project_and_path_from_request, language_and_version_from_path |
| 25 | +from readthedocs.projects.models import HTMLFile, Project |
| 26 | +from readthedocs.redirects.utils import ( |
| 27 | + get_redirect_response, |
| 28 | + project_and_path_from_request, |
| 29 | + language_and_version_from_path |
| 30 | +) |
29 | 31 |
|
30 | 32 | log = logging.getLogger(__name__)
|
31 | 33 |
|
@@ -66,13 +68,13 @@ def get_context_data(self, **kwargs):
|
66 | 68 |
|
67 | 69 |
|
68 | 70 | def random_page(request, project_slug=None): # pylint: disable=unused-argument
|
69 |
| - imported_file = ImportedFile.objects.order_by('?') |
| 71 | + html_file = HTMLFile.objects.order_by('?') |
70 | 72 | if project_slug:
|
71 |
| - imported_file = imported_file.filter(project__slug=project_slug) |
72 |
| - imported_file = imported_file.first() |
73 |
| - if imported_file is None: |
| 73 | + html_file = html_file.filter(project__slug=project_slug) |
| 74 | + html_file = html_file.first() |
| 75 | + if html_file is None: |
74 | 76 | raise Http404
|
75 |
| - url = imported_file.get_absolute_url() |
| 77 | + url = html_file.get_absolute_url() |
76 | 78 | return HttpResponseRedirect(url)
|
77 | 79 |
|
78 | 80 |
|
|
0 commit comments