Commits

tyrion  committed 454edb5

Using "q" as the default query GET param. Should be easier switching to jQuery.
It seems jQuery Autocomplete can't be customized to use "query" instead of "q".

  • Participants
  • Parent commits f4ee902

Comments (0)

Files changed (3)

File autocomplete/media/js/yui_autocomplete.js

         autocomplete.resultTypeList = false;
         autocomplete.queryDelay = .5;
         autocomplete.forceSelection = force_selection;
+        autocomplete.generateRequest = function(sQuery) {
+            return "?q="+sQuery;
+        };
 
         var selected_item = {label: null, id: null};
         var hidden = document.getElementById("id_hidden_"+name);

File autocomplete/views.py

     def __init__(self):
         self.settings = dict()
 
-    def __call__(self, request, ac_name, query_param='query'):
+    def __call__(self, request, ac_name, query_param='q'):
         if not ac_name in self.settings:
             return self.not_found(request, ac_name)
 

File docs/library/views.rst

     consists of a list of *key-label* pairs::
 
         # Request:
-        GET /autocomplete/fruit/?query=red
+        GET /autocomplete/fruit/?q=red
         
         # JSON Response:
         [[9, "Strawberry"], [10, "Cherry"], [11, "Apple"]]
         as views.
 
         The optional argument *query_param* is the name of the GET parameter
-        that should contain the user input. It defaults to ``'query'``.
+        that should contain the user input. It defaults to ``'q'``.
 
         If the Javascript toolkit you're using requires you to use an other
-        value (e.g. ``'q'``) you can customize this param, by passing a
+        value (e.g. ``'query'``) you can customize this param, by passing a
         ``dict`` to the autocomplete view in your URLConf::
 
-            url('^autocomplete/(\w+)$', autocomplete, dict(query_param='q')),
+            url('^autocomplete/(\w+)$', autocomplete, dict(query_param='query')),
 
 
     .. method:: not_found(request, ac_name):