##// END OF EJS Templates
Display proper page for search and notifications divided paginator
neko259 -
r2100:e11ab41b default
parent child Browse files
Show More
@@ -43,6 +43,7 b' class NotificationView(BaseBoardView, Pa'
43 paginator = get_paginator(posts, RESULTS_PER_PAGE,
43 paginator = get_paginator(posts, RESULTS_PER_PAGE,
44 link=reverse('notifications'),
44 link=reverse('notifications'),
45 params=request.GET.dict())
45 params=request.GET.dict())
46 paginator.current_page = page
46
47
47 params[PARAM_PAGE] = paginator.page(page)
48 params[PARAM_PAGE] = paginator.page(page)
48 params[PARAM_USERNAMES] = notification_usernames
49 params[PARAM_USERNAMES] = notification_usernames
@@ -16,7 +16,6 b" FORM_QUERY = 'query'"
16
16
17 CONTEXT_QUERY = 'query'
17 CONTEXT_QUERY = 'query'
18 CONTEXT_FORM = 'form'
18 CONTEXT_FORM = 'form'
19 CONTEXT_PAGE = 'page'
20 CONTEXT_TAGS = 'tags'
19 CONTEXT_TAGS = 'tags'
21
20
22 REQUEST_PAGE = 'page'
21 REQUEST_PAGE = 'page'
@@ -36,6 +35,8 b' class BoardSearchView(View, PaginatedMix'
36 if form.is_valid():
35 if form.is_valid():
37 query = form.cleaned_data[FORM_QUERY]
36 query = form.cleaned_data[FORM_QUERY]
38 if len(query) >= MIN_QUERY_LENGTH:
37 if len(query) >= MIN_QUERY_LENGTH:
38 page = int(request.GET.get(REQUEST_PAGE, '1'))
39
39 results = Post.objects.filter(Q(text__icontains=query)
40 results = Post.objects.filter(Q(text__icontains=query)
40 | Q(title__icontains=query) | Q(opening=True,
41 | Q(title__icontains=query) | Q(opening=True,
41 thread__tags__aliases__name__icontains=query)
42 thread__tags__aliases__name__icontains=query)
@@ -43,8 +44,7 b' class BoardSearchView(View, PaginatedMix'
43 paginator = get_paginator(results, RESULTS_PER_PAGE,
44 paginator = get_paginator(results, RESULTS_PER_PAGE,
44 link=reverse('search'),
45 link=reverse('search'),
45 params=request.GET.dict())
46 params=request.GET.dict())
46
47 paginator.current_page = page
47 page = int(request.GET.get(REQUEST_PAGE, '1'))
48
48
49 params[CONTEXT_QUERY] = query
49 params[CONTEXT_QUERY] = query
50 params.update(self.get_page_context(paginator, page))
50 params.update(self.get_page_context(paginator, page))
General Comments 0
You need to be logged in to leave comments. Login now