Author: floguy
Date: Sat Oct  4 15:56:28 2008
New Revision: 40

Modified:
    trunk/things/templatetags/things_tags.py

Log:
Added the ability to persist getvars, and to clear the search.

Modified: trunk/things/templatetags/things_tags.py
==============================================================================
--- trunk/things/templatetags/things_tags.py    (original)
+++ trunk/things/templatetags/things_tags.py    Sat Oct  4 15:56:28 2008
@@ -3,6 +3,23 @@

  register = template.Library()

+def clear_search_url(request):
+    getvars = request.GET.copy()
+    if 'search' in getvars:
+        del getvars['search']
+    if len(getvars.keys()) > 0:
+        return "%s?%s" % (request.path, getvars.urlencode())
+    else:
+        return request.path
+register.simple_tag(clear_search_url)
+
+def persist_getvars(request):
+    getvars = request.GET.copy()
+    if len(getvars.keys()) > 0:
+        return "?%s" % getvars.urlencode()
+    return ''
+register.simple_tag(persist_getvars)
+
  def item_url(url_prefix, name_prefix, item):
      try:
          return item.get_absolute_url()
@@ -18,6 +35,7 @@
          'fields': context['fields'],
          'field': context['field'],
          'descending': context['descending'],
+        'request': context['request'],
      }
  register.inclusion_tag('things/ordering.html',  
takes_context=True)(display_ordering)

@@ -25,5 +43,6 @@
      return {
          'search_enabled': context['search_enabled'],
          'terms': context['terms'],
+        'request': context['request'],
      }
  register.inclusion_tag('things/search.html',  
takes_context=True)(display_search)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to