mirror of
https://github.com/Hopiu/django-watson.git
synced 2026-03-16 22:00:22 +00:00
Merge pull request #173 from SimonGreenhill/master
removing patterns import
This commit is contained in:
commit
dd4cbc8db3
7 changed files with 37 additions and 41 deletions
25
.travis.yml
25
.travis.yml
|
|
@ -8,23 +8,16 @@ cache:
|
|||
directories:
|
||||
- $HOME/.cache/pip
|
||||
env:
|
||||
- DJANGO=django==1.7.11
|
||||
- DJANGO=django==1.7.11 DB_ENGINE="django.db.backends.postgresql_psycopg2" DB_NAME="test_project" DB_USER="postgres"
|
||||
- DJANGO=django==1.7.11 DB_ENGINE="django.db.backends.mysql" DB_NAME="test_project" DB_USER="travis"
|
||||
- DJANGO=django==1.8.12
|
||||
- DJANGO=django==1.8.12 DB_ENGINE="django.db.backends.postgresql_psycopg2" DB_NAME="test_project" DB_USER="postgres"
|
||||
- DJANGO=django==1.8.12 DB_ENGINE="django.db.backends.mysql" DB_NAME="test_project" DB_USER="travis"
|
||||
- DJANGO=django==1.9.5
|
||||
- DJANGO=django==1.9.5 DB_ENGINE="django.db.backends.postgresql" DB_NAME="test_project" DB_USER="postgres"
|
||||
- DJANGO=django==1.9.5 DB_ENGINE="django.db.backends.mysql" DB_NAME="test_project" DB_USER="travis"
|
||||
- DJANGO=django==1.8.14
|
||||
- DJANGO=django==1.8.14 DB_ENGINE="django.db.backends.postgresql_psycopg2" DB_NAME="test_project" DB_USER="postgres"
|
||||
- DJANGO=django==1.8.14 DB_ENGINE="django.db.backends.mysql" DB_NAME="test_project" DB_USER="travis"
|
||||
- DJANGO=django==1.9.9
|
||||
- DJANGO=django==1.9.9 DB_ENGINE="django.db.backends.postgresql" DB_NAME="test_project" DB_USER="postgres"
|
||||
- DJANGO=django==1.9.9 DB_ENGINE="django.db.backends.mysql" DB_NAME="test_project" DB_USER="travis"
|
||||
- DJANGO=django==1.10
|
||||
- DJANGO=django==1.10 DB_ENGINE="django.db.backends.postgresql" DB_NAME="test_project" DB_USER="postgres"
|
||||
- DJANGO=django==1.10 DB_ENGINE="django.db.backends.mysql" DB_NAME="test_project" DB_USER="travis"
|
||||
matrix:
|
||||
exclude:
|
||||
- python: 3.5
|
||||
env: DJANGO=django==1.7.11
|
||||
- python: 3.5
|
||||
env: DJANGO=django==1.7.11 DB_ENGINE="django.db.backends.postgresql_psycopg2" DB_NAME="test_project" DB_USER="postgres"
|
||||
- python: 3.5
|
||||
env: DJANGO=django==1.7.11 DB_ENGINE="django.db.backends.mysql" DB_NAME="test_project" DB_USER="travis"
|
||||
fast_finish: true
|
||||
services:
|
||||
- postgresql
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ def main():
|
|||
DATABASES={
|
||||
"default": database_setting
|
||||
},
|
||||
ROOT_URLCONF="urls",
|
||||
ROOT_URLCONF='test_watson.urls',
|
||||
INSTALLED_APPS=(
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
|
|
@ -93,6 +93,12 @@ def main():
|
|||
USE_TZ=True,
|
||||
STATIC_URL="/static/",
|
||||
TEST_RUNNER="django.test.runner.DiscoverRunner",
|
||||
TEMPLATES=[{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': ['templates'],
|
||||
'APP_DIRS': True,
|
||||
}],
|
||||
|
||||
)
|
||||
# Run Django setup (1.7+).
|
||||
import django
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ from watson.backends import escape_query
|
|||
from test_watson.models import WatsonTestModel1, WatsonTestModel2
|
||||
from test_watson import admin # Force early registration of all admin models.
|
||||
|
||||
|
||||
class RegistrationTest(TestCase):
|
||||
|
||||
def testRegistration(self):
|
||||
|
|
@ -560,9 +559,7 @@ class ComplexRegistrationTest(SearchTestBase):
|
|||
|
||||
|
||||
class AdminIntegrationTest(SearchTestBase):
|
||||
|
||||
urls = "test_watson.urls"
|
||||
|
||||
|
||||
def setUp(self):
|
||||
super(AdminIntegrationTest, self).setUp()
|
||||
self.user = User(
|
||||
|
|
@ -601,9 +598,6 @@ class AdminIntegrationTest(SearchTestBase):
|
|||
|
||||
|
||||
class SiteSearchTest(SearchTestBase):
|
||||
|
||||
urls = "test_watson.urls"
|
||||
|
||||
def testSiteSearch(self):
|
||||
# Test a search than should find everything.
|
||||
response = self.client.get("/simple/?q=title")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
from django.conf.urls import patterns, url, include
|
||||
from django.conf.urls import url, include
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
urlpatterns = patterns("",
|
||||
urlpatterns = [
|
||||
|
||||
url("^simple/", include("watson.urls")),
|
||||
|
||||
|
|
@ -17,5 +17,4 @@ urlpatterns = patterns("",
|
|||
}),
|
||||
|
||||
url("^admin/", include(admin.site.urls)),
|
||||
|
||||
)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,4 @@ should be added within the test folders, and use TestCase.urls to set them.
|
|||
This helps the tests remain isolated.
|
||||
"""
|
||||
|
||||
from django.conf.urls import patterns
|
||||
|
||||
|
||||
urlpatterns = patterns("")
|
||||
urlpatterns = []
|
||||
|
|
|
|||
|
|
@ -58,28 +58,35 @@ class Command(BaseCommand):
|
|||
args = "[[--engine=search_engine] <app.model|model> <app.model|model> ... ]"
|
||||
help = "Rebuilds the database indices needed by django-watson. You can (re-)build index for selected models by specifying them"
|
||||
|
||||
option_list = BaseCommand.option_list + (
|
||||
make_option("--engine",
|
||||
help="Search engine models are registered with"),
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("apps", nargs="*", action="store", default=[])
|
||||
parser.add_argument('--engine',
|
||||
action="store",
|
||||
help='Search engine models are registered with'
|
||||
)
|
||||
|
||||
|
||||
@transaction.atomic()
|
||||
def handle(self, *args, **options):
|
||||
"""Runs the management command."""
|
||||
activate(settings.LANGUAGE_CODE)
|
||||
verbosity = int(options.get("verbosity", 1))
|
||||
|
||||
|
||||
# see if we're asked to use a specific search engine
|
||||
if options['engine']:
|
||||
if options.get('engine'):
|
||||
engine_slug = options['engine']
|
||||
engine_selected = True
|
||||
else:
|
||||
engine_slug = "default"
|
||||
engine_selected = False
|
||||
|
||||
|
||||
# work-around for legacy optparser hack in BaseCommand. In Django=1.10 the
|
||||
# args are collected in options['apps'], but in earlier versions they are
|
||||
# kept in args.
|
||||
if len(options['apps']):
|
||||
args = options['apps']
|
||||
|
||||
# get the search engine we'll be checking registered models for, may be "default"
|
||||
search_engine = get_engine(engine_slug)
|
||||
|
||||
models = []
|
||||
for model_name in args:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf.urls import url, patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from watson.views import search, search_json
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue