mirror of
https://github.com/Hopiu/django-watson.git
synced 2026-03-16 22:00:22 +00:00
commit
93ac21c16b
7 changed files with 12 additions and 27 deletions
21
.travis.yml
21
.travis.yml
|
|
@ -4,32 +4,23 @@ python:
|
|||
- 3.8
|
||||
- 3.7
|
||||
- 3.6
|
||||
- 3.5
|
||||
- 2.7
|
||||
cache: pip
|
||||
env:
|
||||
global:
|
||||
- PYTHONWARNINGS=default,ignore::PendingDeprecationWarning,ignore::ResourceWarning
|
||||
matrix:
|
||||
- DJANGO='>=3.0,<3.1'
|
||||
- DJANGO='>=2.2,<3.0'
|
||||
- DJANGO='>=2.1,<2.2'
|
||||
- DJANGO='>=2.0,<2.1'
|
||||
- DJANGO='>=1.11,<1.12'
|
||||
- DJANGO='>=1.10,<1.11'
|
||||
- DJANGO='>=1.9,<1.10'
|
||||
- DJANGO='>=1.8,<1.9'
|
||||
matrix:
|
||||
fast_finish: true
|
||||
exclude:
|
||||
- python: 3.8
|
||||
env: DJANGO='>=1.10,<1.11'
|
||||
- python: 3.8
|
||||
env: DJANGO='>=1.9,<1.10'
|
||||
- python: 3.8
|
||||
env: DJANGO='>=1.8,<1.9'
|
||||
- python: 2.7
|
||||
env: DJANGO='>=2.0,<2.1'
|
||||
- python: 2.7
|
||||
env: DJANGO='>=2.1,<2.2'
|
||||
env: DJANGO='>=1.11,<1.12'
|
||||
- python: 3.7
|
||||
env: DJANGO='>=1.11,<1.12'
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
|
|
@ -56,7 +47,7 @@ deploy:
|
|||
secure: rzaq3pbJz25SVXyR/fn+gLaYxu0LqCEE+wcesg8pjA8cLLvFdLvXi0ZjmixxVl2u4HlndZrUgwTrRGVIQR1TOL0jGRYOUCJDzAaZqJkg+Qykz89iKSnentyOpNJe6fRAHsqFxBESYZjG8JEZvtRv+JIZLY+QR+KCA1xaeu4Afpw=
|
||||
on:
|
||||
tags: true
|
||||
condition: $DJANGO = '>=2.0,<2.1'
|
||||
condition: $DJANGO = '>=3.0,<3.1'
|
||||
python: 3.8
|
||||
repo: etianen/django-watson
|
||||
notifications:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Features
|
|||
* Order results by relevance.
|
||||
* No need to install additional third-party modules or services.
|
||||
* Fast and scaleable enough for most use cases.
|
||||
* Supports Django 1.8+, Python 2.7+.
|
||||
* Supports Django 1.11+, Python 3.6+.
|
||||
|
||||
|
||||
Documentation
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -33,8 +33,6 @@ setup(
|
|||
"License :: OSI Approved :: BSD License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import uuid
|
||||
from django.db import models
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class TestModelBase(models.Model):
|
||||
title = models.CharField(
|
||||
max_length=200,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ from django.db import transaction, connections, router
|
|||
from django.db.models import Q, FloatField
|
||||
from django.db.models.expressions import RawSQL, Value
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils import six
|
||||
|
||||
from watson.models import SearchEntry, has_int_pk
|
||||
|
||||
|
|
@ -43,7 +42,7 @@ def escape_query(text, re_escape_chars):
|
|||
return text
|
||||
|
||||
|
||||
class SearchBackend(six.with_metaclass(abc.ABCMeta)):
|
||||
class SearchBackend(metaclass=abc.ABCMeta):
|
||||
"""Base class for all search backends."""
|
||||
|
||||
def is_installed(self):
|
||||
|
|
@ -87,7 +86,7 @@ class SearchBackend(six.with_metaclass(abc.ABCMeta)):
|
|||
return connection.ops.quote_name(column_name)
|
||||
|
||||
|
||||
class RegexSearchMixin(six.with_metaclass(abc.ABCMeta)):
|
||||
class RegexSearchMixin(metaclass=abc.ABCMeta):
|
||||
|
||||
"""Mixin to adding regex search to a search backend."""
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import uuid
|
|||
|
||||
from django.db import models
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.utils.encoding import python_2_unicode_compatible, force_text
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
try:
|
||||
|
|
@ -42,7 +42,6 @@ def get_str_pk(obj, connection):
|
|||
META_CACHE_KEY = "_meta_cache"
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class SearchEntry(models.Model):
|
||||
|
||||
"""An entry in the search index."""
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import json
|
|||
|
||||
from django.shortcuts import redirect
|
||||
from django.http import HttpResponse
|
||||
from django.utils import six
|
||||
from django.views import generic
|
||||
from django.views.generic.list import BaseListView
|
||||
|
||||
|
|
@ -66,7 +65,7 @@ class SearchMixin(object):
|
|||
context = super(SearchMixin, self).get_context_data(**kwargs)
|
||||
context["query"] = self.query
|
||||
# Process extra context.
|
||||
for key, value in six.iteritems(self.get_extra_context()):
|
||||
for key, value in self.get_extra_context().items():
|
||||
if callable(value):
|
||||
value = value()
|
||||
context[key] = value
|
||||
|
|
|
|||
Loading…
Reference in a new issue