summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-15 09:02:22 -0500
committerDan McGee <dan@archlinux.org>2011-03-15 09:08:10 -0500
commita0ef88770f5fe318f38eaa7dc794727a507c797b (patch)
tree1f101c1caef3f276e3a5b1cc8b5ad8763d8a0999 /templates
parent3d6392391b3a0b37bea06f36f1998344ae170df2 (diff)
Ensure package search form correctly handles errorsrelease_2011-03-15
We were silently eating errors and just showing a normal package list if the form didn't validate. Rather than do that, make sure we return no packages at all and display the form errors back to the user in a sane fashion. Adjust the validation methods on the 'limit' parameter so any integer is acceptable. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'templates')
-rw-r--r--templates/packages/search.html52
1 files changed, 30 insertions, 22 deletions
diff --git a/templates/packages/search.html b/templates/packages/search.html
index 8ea53b8e..381ebb01 100644
--- a/templates/packages/search.html
+++ b/templates/packages/search.html
@@ -14,28 +14,36 @@
<h3>Package Search</h3>
- <form id="pkg-search" method="get" action="/packages/">
- <p><input type="hidden" name="sort" value='{{sort}}' /></p>
- <fieldset>
- <legend>Enter search criteria</legend>
- <div><label for="id_arch" title="Limit results a specific CPU architecture">
- Arch</label>{{ search_form.arch }}</div>
- <div><label for="id_repo" title="Limit results to a specific respository">
- Repository</label>{{ search_form.repo }}</div>
- <div><label for="id_q" title="Enter keywords as desired">
- Keywords</label>{{ search_form.q }}</div>
- <div><label for="id_maintainer" title="Limit results to a specific maintainer">
- Maintainer</label>{{ search_form.maintainer}}</div>
- <div><label for="id_last_update" title="Limit results to a date after the date entered">
- Last Updated After</label>{{ search_form.last_update }}</div>
- <div><label for="id_flagged" title="Limit results based on out-of-date status">
- Flagged</label>{{ search_form.flagged }}</div>
- <div><label for="id_limit" title="Select the number of results to display per page">
- Per Page</label>{{ search_form.limit }}</div>
- <div ><label>&nbsp;</label><input title="Search for packages using this criteria"
- type="submit" value="Search" /></div>
- </fieldset>
- </form>
+ <form id="pkg-search" method="get" action="/packages/">
+ <p><input type="hidden" name="sort" value='{{sort}}' /></p>
+ {{ search_form.non_field_errors }}
+ <fieldset>
+ <legend>Enter search criteria</legend>
+ <div>{{ search_form.arch.errors }}
+ <label for="id_arch" title="Limit results a specific CPU architecture">
+ Arch</label>{{ search_form.arch }}</div>
+ <div>{{ search_form.repo.errors }}
+ <label for="id_repo" title="Limit results to a specific respository">
+ Repository</label>{{ search_form.repo }}</div>
+ <div>{{ search_form.q.errors }}
+ <label for="id_q" title="Enter keywords as desired">
+ Keywords</label>{{ search_form.q }}</div>
+ <div>{{ search_form.maintainer.errors }}
+ <label for="id_maintainer" title="Limit results to a specific maintainer">
+ Maintainer</label>{{ search_form.maintainer}}</div>
+ <div>{{ search_form.last_update.errors }}
+ <label for="id_last_update" title="Limit results to a date after the date entered">
+ Last Updated After</label>{{ search_form.last_update }}</div>
+ <div>{{ search_form.flagged.errors }}
+ <label for="id_flagged" title="Limit results based on out-of-date status">
+ Flagged</label>{{ search_form.flagged }}</div>
+ <div>{{ search_form.limit.errors }}
+ <label for="id_limit" title="Select the number of results to display per page">
+ Per Page</label>{{ search_form.limit }}</div>
+ <div ><label>&nbsp;</label><input title="Search for packages using this criteria"
+ type="submit" value="Search" /></div>
+ </fieldset>
+ </form>
</div><!-- #pkglist-search -->