summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-02-16 15:38:29 -0600
committerDan McGee <dan@archlinux.org>2013-02-16 15:39:23 -0600
commit746023d529489b68f1a2494ff7572734b3b368ce (patch)
treed6c1f09ad778db6c8117dc5b642d9683671c963b
parente3837b5a872b6203b7ae338bc8075b339e031627 (diff)
Make page a query string parameter on package search
This is a bit silly to encode in the URL, or at least makes it much harder to screen out via robots.txt and other such things. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/urls.py1
-rw-r--r--packages/views/display.py2
-rw-r--r--templates/packages/search_paginator.html4
3 files changed, 4 insertions, 3 deletions
diff --git a/packages/urls.py b/packages/urls.py
index 9a151b4b..4e2e2638 100644
--- a/packages/urls.py
+++ b/packages/urls.py
@@ -24,7 +24,6 @@ urlpatterns = patterns('packages.views',
(r'^update/$', 'update'),
(r'^$', SearchListView.as_view(), {}, 'packages-search'),
- (r'^(?P<page>\d+)/$', SearchListView.as_view()),
(r'^search/json/$', 'search_json'),
(r'^differences/$', 'arch_differences', {}, 'packages-differences'),
diff --git a/packages/views/display.py b/packages/views/display.py
index 497c8d48..fcf8fdea 100644
--- a/packages/views/display.py
+++ b/packages/views/display.py
@@ -104,6 +104,8 @@ def redirect_agnostic(request, name, repo, arch):
def redirect_to_search(request, name, repo, arch):
+ if request.GET.get('q'):
+ name = request.GET.get('q')
pkg_data = [
('arch', arch.lower()),
('repo', repo.lower()),
diff --git a/templates/packages/search_paginator.html b/templates/packages/search_paginator.html
index 758dca4c..3c368b82 100644
--- a/templates/packages/search_paginator.html
+++ b/templates/packages/search_paginator.html
@@ -6,7 +6,7 @@
<div class="pkglist-nav">
<span class="prev">
{% if page_obj.has_previous %}
- <a href="/packages/{{ page_obj.previous_page_number }}/?{{ current_query }}"
+ <a href="?page={{ page_obj.previous_page_number }}&amp;{{ current_query }}"
title="Go to previous page">&lt; Prev</a>
{% else %}
&lt; Prev
@@ -14,7 +14,7 @@
</span>
<span class="next">
{% if page_obj.has_next %}
- <a href="/packages/{{ page_obj.next_page_number }}/?{{ current_query }}"
+ <a href="?page={{ page_obj.next_page_number }}&amp;{{ current_query }}"
title="Go to next page">Next &gt;</a>
{% else %}
Next &gt;