Skip to content

Instantly share code, notes, and snippets.

@stuross
Created January 9, 2012 20:33
Show Gist options
  • Save stuross/1584791 to your computer and use it in GitHub Desktop.
Save stuross/1584791 to your computer and use it in GitHub Desktop.
change to generickey.js
valueMatches : function(facet, searchTerm, callback) {
if('results' in facets.raw[facet]){
callback(facets.raw[facet].results);
} else{
var app_label = facets.raw[facet].app_label,
model = facet;
// TODO: don't pound the server
$.getJSON("/admin/" + app_label + "/" + model + "/search/", {q: searchTerm}, function(data) {
facets.raw[facet].results = data.results;
callback(data.results);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment