diff gpp/weblinks/views.py @ 21:884839ddbfde

Webinks: added a navigation template tag so views don't have to keep constructing the searc form. Also provided a count of search results on the template.
author Brian Neal <bgneal@gmail.com>
date Sun, 19 Apr 2009 21:00:06 +0000
parents c0d0779b266f
children 62eb9cbbcffc
line wrap: on
line diff
--- a/gpp/weblinks/views.py	Sun Apr 19 20:41:37 2009 +0000
+++ b/gpp/weblinks/views.py	Sun Apr 19 21:00:06 2009 +0000
@@ -34,11 +34,9 @@
 def link_index(request):
    categories = Category.objects.all()
    total_links = Link.public_objects.all().count()
-   form = SearchForm()
    return render_to_response('weblinks/index.html', {
       'categories': categories, 
       'total_links': total_links,
-      'search_form': form,
       },
       context_instance = RequestContext(request))
 
@@ -49,7 +47,6 @@
    return render_to_response('weblinks/link_summary.html', {
       'links': links, 
       'title': 'Newest Links',
-      'search_form': SearchForm(),
       },
       context_instance = RequestContext(request))
 
@@ -60,7 +57,6 @@
    return render_to_response('weblinks/link_summary.html', {
       'links': links, 
       'title': 'Popular Links',
-      'search_form': SearchForm(),
       },
       context_instance = RequestContext(request))
 
@@ -84,7 +80,6 @@
       add_form = AddLinkForm()
 
    return render_to_response('weblinks/add_link.html', {
-      'search_form': SearchForm(),
       'add_form': add_form,
       },
       context_instance = RequestContext(request))
@@ -94,7 +89,6 @@
 @login_required
 def add_thanks(request):
    return render_to_response('weblinks/add_link.html', {
-      'search_form': SearchForm(),
       },
       context_instance = RequestContext(request))
 
@@ -131,7 +125,6 @@
       's' : sort,
       'category' : cat,
       'page' : the_page, 
-      'search_form': SearchForm(),
       }, 
       context_instance = RequestContext(request))
 
@@ -173,7 +166,6 @@
 
    return render_to_response('weblinks/report_link.html', {
       'link': link, 
-      'search_form': SearchForm(),
       'report_thanks': False,
       },
       context_instance = RequestContext(request))
@@ -186,7 +178,6 @@
    link = get_object_or_404(Link, pk = link_id)
    return render_to_response('weblinks/report_link.html', {
       'link': link, 
-      'search_form': SearchForm(),
       'report_thanks': True,
       },
       context_instance = RequestContext(request))
@@ -221,7 +212,6 @@
    return render_to_response('weblinks/search_results.html', {
       'query': query_text,
       'page': the_page, 
-      'search_form': SearchForm(),
       }, 
       context_instance = RequestContext(request))
 
@@ -231,6 +221,5 @@
     link = get_object_or_404(Link, pk=id)
     return render_to_response('weblinks/link_detail.html', {
         'link': link, 
-        'search_form': SearchForm(),
         },
         context_instance = RequestContext(request))