Skip to content

Commit

Permalink
Drop support for Python2, Django<1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
hugorodgerbrown committed May 11, 2018
1 parent adc8328 commit 6c7ad08
Show file tree
Hide file tree
Showing 29 changed files with 52 additions and 64 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ dist:
language:
python
python:
- "2.7"
- "3.6"
install:
pip install tox-travis
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
.. image:: https://badge.fury.io/py/elasticsearch_django.svg
:target: https://badge.fury.io/py/elasticsearch_django

**This project now requires Python3 and Django1.11 or above. For previous versions please refer to the Python2 branch.**

Elasticsearch for Django
========================

Expand Down
1 change: 0 additions & 1 deletion elasticsearch_django/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# -*- coding: utf-8 -*-
default_app_config = 'elasticsearch_django.apps.ElasticAppConfig'
2 changes: 0 additions & 2 deletions elasticsearch_django/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
"""elasticsearch_django model admin."""
import simplejson as json # simplejson supports Decimal serialization
import logging

Expand Down
1 change: 0 additions & 1 deletion elasticsearch_django/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import logging

from django.apps import AppConfig
Expand Down
5 changes: 0 additions & 5 deletions elasticsearch_django/compat.py

This file was deleted.

2 changes: 0 additions & 2 deletions elasticsearch_django/index.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
"""Search3 index-related functions."""
import logging

from elasticsearch import helpers
Expand Down
5 changes: 1 addition & 4 deletions elasticsearch_django/management/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
"""Base command for search-related management commands."""
import logging

import builtins
import logging

from django.core.management.base import BaseCommand

from elasticsearch.exceptions import TransportError

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Create a search index."""
from . import BaseSearchCommand
from ...index import create_index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Delete a search index (and all documents therein)."""
import logging

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Remove all documents in a search index that no longer exist in source queryset."""
from . import BaseSearchCommand
from ...index import prune_index
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Create a search index."""
import logging

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Update all documents in a search index."""
from . import BaseSearchCommand
from ...index import update_index
Expand Down
4 changes: 1 addition & 3 deletions elasticsearch_django/migrations/0005_convert_JSONFields.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-01-03 16:11
from __future__ import unicode_literals

from django.contrib.postgres.fields import JSONField
from django.db import migrations

from ..db.fields import JSONField


class Migration(migrations.Migration):

Expand Down
25 changes: 25 additions & 0 deletions elasticsearch_django/migrations/0007_update_json_field_encoders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 2.0.5 on 2018-05-11 13:30

import django.contrib.postgres.fields.jsonb
import django.core.serializers.json
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('elasticsearch_django', '0006_add_encoder_JSONField_kwarg'),
]

operations = [
migrations.AlterField(
model_name='searchquery',
name='hits',
field=django.contrib.postgres.fields.jsonb.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder, help_text='The list of meta info for each of the query matches returned.'),
),
migrations.AlterField(
model_name='searchquery',
name='query',
field=django.contrib.postgres.fields.jsonb.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder, help_text='The raw ElasticSearch DSL query.'),
),
]
7 changes: 2 additions & 5 deletions elasticsearch_django/models.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import logging
import time

from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.core.cache import cache
from django.db.models.fields import CharField
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.db.models.expressions import RawSQL
from django.db.models.fields import CharField
from django.utils.timezone import now as tz_now

from .db.fields import JSONField
from .settings import (
get_client,
get_model_indexes,
Expand Down
1 change: 0 additions & 1 deletion elasticsearch_django/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Access to SEARCH_SETTINGS Django conf.
The SEARCH_SETTINGS dict in the Django conf contains three
Expand Down
1 change: 0 additions & 1 deletion elasticsearch_django/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# search.tests package identifier
from django.db import models

Expand Down
4 changes: 2 additions & 2 deletions elasticsearch_django/tests/test_apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from unittest import mock

from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase

Expand All @@ -13,7 +14,6 @@
_update_search_index,
)
from .. import tests
from ..compat import mock
from ..models import SearchDocumentMixin
from ..tests import TestModel

Expand Down
5 changes: 2 additions & 3 deletions elasticsearch_django/tests/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
from django.test import TestCase
from unittest import mock

from django.test import TestCase
from elasticsearch.exceptions import TransportError

from ..compat import mock
from ..management.commands import (
BaseSearchCommand,
create_search_index,
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch_django/tests/test_index_functions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from unittest import mock

from django.test import TestCase

from ..compat import mock
from ..index import (
create_index,
update_index,
Expand Down
2 changes: 0 additions & 2 deletions elasticsearch_django/tests/test_migrations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

from django.apps import apps
from django.db import connection
from django.db.migrations.autodetector import MigrationAutodetector
Expand Down
4 changes: 1 addition & 3 deletions elasticsearch_django/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# -*- coding: utf-8 -*-
import datetime
import decimal
from unittest import mock

from django.db.models import Model
from django.test import TestCase
from django.utils.timezone import now as tz_now

from elasticsearch_dsl.search import Search

from ..compat import mock
from ..models import (
SearchDocumentMixin,
SearchDocumentManagerMixin,
Expand Down
4 changes: 1 addition & 3 deletions elasticsearch_django/tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import mock

from django.test import TestCase
from django.test.utils import override_settings

from ..compat import mock
from ..settings import (
get_client,
get_setting,
Expand Down
1 change: 0 additions & 1 deletion elasticsearch_django/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.test import TestCase

from ..settings import get_setting
Expand Down
1 change: 0 additions & 1 deletion elasticsearch_django/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from contextlib import contextmanager

from .settings import get_settings
Expand Down
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from os import path, chdir, pardir
from setuptools import setup, find_packages

Expand All @@ -9,10 +8,10 @@

setup(
name="elasticsearch-django",
version="5.0.6",
version="5.1",
packages=find_packages(),
install_requires=[
'Django>=1.9',
'Django>=1.11',
'elasticsearch>=5',
'elasticsearch-dsl>=5',
'psycopg2>=2.6',
Expand All @@ -34,11 +33,9 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Framework :: Django',
'Framework :: Django :: 1.9',
'Framework :: Django :: 1.10',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
Expand Down
10 changes: 4 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[tox]
envlist = py{27,36}-django{19,110,111}
envlist = py{36}-django{111,20}

[testenv]
deps =
coverage==4.2
dj-database-url==0.4
py27: mock==2.0
django19: Django==1.9
django110: Django==1.10
coverage
dj-database-url
django111: Django==1.11
django20: Django==2.0

commands =
python --version
Expand Down
10 changes: 6 additions & 4 deletions urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# urls for the development project
from django.conf.urls import include, url

from django.contrib import admin
try:
from django.urls import re_path, include
except ImportError:
from django.conf.urls import url as re_path, include

admin.autodiscover()

urlpatterns = [
url(r'^admin/', include(admin.site.urls,)),
re_path(r'^admin/', admin.site.urls),
]

0 comments on commit 6c7ad08

Please sign in to comment.