File tree 2 files changed +5
-13
lines changed
2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change 5
5
from readthedocs .builds import views as build_views
6
6
from readthedocs .constants import pattern_opts
7
7
from readthedocs .projects .views import public
8
- from readthedocs .projects .views .public import ProjectDetailView , ProjectIndex
8
+ from readthedocs .projects .views .public import ProjectDetailView , ProjectTagIndex
9
9
from readthedocs .search import views as search_views
10
10
11
11
12
12
urlpatterns = [
13
- url (
14
- r'^$' ,
15
- ProjectIndex .as_view (),
16
- name = 'projects_list' ,
17
- ),
18
13
url (
19
14
r'^(?P<invalid_project_slug>{project_slug}_{project_slug})/' .format (** pattern_opts ),
20
15
public .project_redirect ,
78
73
),
79
74
url (
80
75
r'^tags/(?P<tag>[-\w]+)/$' ,
81
- ProjectIndex .as_view (),
76
+ ProjectTagIndex .as_view (),
82
77
name = 'projects_tag_detail' ,
83
78
),
84
79
]
Original file line number Diff line number Diff line change 37
37
mimetypes .add_type ('application/epub+zip' , '.epub' )
38
38
39
39
40
- class ProjectIndex (ListView ):
40
+ class ProjectTagIndex (ListView ):
41
41
42
42
"""List view of public :py:class:`Project` instances."""
43
43
@@ -47,11 +47,8 @@ def get_queryset(self):
47
47
queryset = Project .objects .public (self .request .user )
48
48
queryset = queryset .exclude (users__profile__banned = True )
49
49
50
- if self .kwargs .get ('tag' ):
51
- self .tag = get_object_or_404 (Tag , slug = self .kwargs .get ('tag' ))
52
- queryset = queryset .filter (tags__slug__in = [self .tag .slug ])
53
- else :
54
- self .tag = None
50
+ self .tag = get_object_or_404 (Tag , slug = self .kwargs .get ('tag' ))
51
+ queryset = queryset .filter (tags__slug__in = [self .tag .slug ])
55
52
56
53
if self .kwargs .get ('username' ):
57
54
self .user = get_object_or_404 (
You can’t perform that action at this time.
0 commit comments