def search(request): search_proxies = PeopleSearchProxy.objects_by_account(request.account).all() if 'q' in request.GET: q = request.GET['q'] if q != "": search_proxies = PeopleSearchProxy.search(request.account, q,ignorable_chars=["-","(",")"]) return locals()
def search_results(request): search_proxies = PeopleSearchProxy.objects_by_account(request.account).all() if 'q' in request.GET: q = request.GET['q'] if q != "": search_proxies = PeopleSearchProxy.search(request.account, q,ignorable_chars=["-","(",")"]) return {"fragments":{"main_search_results":render_to_string("people/_search_results.html", locals())}}
def forwards(self, orm): "Write your forwards methods here." print "Starting update of search proxies. Clearing old proxies..." cache.clear() PeopleSearchProxy.objects.all().delete() print "Organizations cleared." OrganizationsSearchProxy.objects.all().delete() print "People cleared." print "Re-saving organizations..." OrganizationsSearchProxy.resave_all_organizations(verbose=True) print "Re-saving people..." PeopleSearchProxy.resave_all_people(verbose=True) print "Invalidating cache.." jcache.invalidate(PeopleSearchProxy) jcache.invalidate(OrganizationsSearchProxy) print "Done."
def handle(self, *args, **options): from people.models import PeopleSearchProxy from organizations.models import OrganizationsSearchProxy from groups.models import GroupSearchProxy from spreadsheets.models import SpreadsheetSearchProxy print "Repopulating people...", PeopleSearchProxy.populate_cache() print "done." print "Repopulating organizations..." OrganizationsSearchProxy.populate_cache() print "done." print "Repopulating groups..." GroupSearchProxy.populate_cache() print "done." print "Repopulating spreadsheets..." SpreadsheetSearchProxy.populate_cache() print "done."