Remove remaining code for the old search method and the advanced search support, misc cleanups too
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from urlparse import urlparse, parse_qs
|
||||
from urllib import unquote_plus
|
||||
|
||||
from django.utils.simplejson import dumps, loads, JSONEncoder
|
||||
from django.utils.simplejson import dumps
|
||||
from django.db.models import Manager
|
||||
from django.utils.http import urlencode
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.contenttypes import generic
|
||||
from django.utils.encoding import smart_unicode, smart_str
|
||||
from django.utils.encoding import smart_str
|
||||
|
||||
from dynamic_search.conf.settings import RECENT_COUNT
|
||||
from .conf.settings import RECENT_COUNT
|
||||
|
||||
|
||||
class RecentSearchManager(Manager):
|
||||
def add_query_for_user(self, search_view):#user, url, hits):
|
||||
def add_query_for_user(self, search_view):
|
||||
query_dict = parse_qs(unquote_plus(smart_str(urlparse(search_view.request.get_full_path()).query)))
|
||||
|
||||
if query_dict and not isinstance(search_view.request.user, AnonymousUser):
|
||||
@@ -35,13 +35,13 @@ class IndexableObjectManager(Manager):
|
||||
return self.model.objects.filter(datetime__gte=datetime)
|
||||
else:
|
||||
return self.model.objects.all()
|
||||
|
||||
|
||||
def get_indexables_pk_list(self, datetime=None):
|
||||
return self.get_indexables(datetime).values_list('object_id', flat=True)
|
||||
|
||||
def mark_indexable(self, obj):
|
||||
content_type = ContentType.objects.get_for_model(obj)
|
||||
self.model.objects.get_or_create(content_type=content_type, object_id=obj.pk)
|
||||
|
||||
|
||||
def clear_all(self):
|
||||
self.model.objects.all().delete()
|
||||
|
||||
Reference in New Issue
Block a user