Skip to content

Commit

Permalink
Merge pull request #488 from carltongibson/develop
Browse files Browse the repository at this point in the history
O.15 Release
  • Loading branch information
Carlton Gibson committed Sep 20, 2016
2 parents 0b90d87 + 97f11fd commit a02db39
Show file tree
Hide file tree
Showing 47 changed files with 2,491 additions and 718 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.14.0
current_version = 0.15.0
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
Expand Down
27 changes: 16 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ python:
- "3.5"

env:
- DJANGO='https://github.com/django/django/archive/master.tar.gz'
- DJANGO='django>=1.10.0,<1.11.0'
- DJANGO='django>=1.9.0,<1.10.0'
- DJANGO='django>=1.8.0,<1.9.0'
- DJANGO='https://github.com/django/django/archive/master.tar.gz' REST_FRAMEWORK='djangorestframework>=3.4,<3.5'
- DJANGO="django>=1.10.0,<1.11.0" REST_FRAMEWORK="djangorestframework>=3.4,<3.5"
- DJANGO="django>=1.9.0,<1.10.0" REST_FRAMEWORK="djangorestframework>=3.4,<3.5"
- DJANGO="django>=1.8.0,<1.9.0" REST_FRAMEWORK="djangorestframework>=3.4,<3.5"
- DJANGO="django>=1.8.0,<1.9.0" REST_FRAMEWORK="djangorestframework>=3.3,<3.4"

install:
- travis_retry pip install $DJANGO
- travis_retry pip install -r requirements/travis-ci.txt
- travis_retry pip install -Ur requirements/test-ci.txt
- travis_retry pip install $DJANGO $REST_FRAMEWORK

script:
- coverage run --source django_filters runtests.py -v 2
- $W coverage run --source django_filters runtests.py -v 2
- coverage report

notifications:
Expand All @@ -30,11 +31,15 @@ notifications:
matrix:
exclude:
- python: "3.3"
env: DJANGO='https://github.com/django/django/archive/master.tar.gz'
env: DJANGO='https://github.com/django/django/archive/master.tar.gz' REST_FRAMEWORK='djangorestframework>=3.4,<3.5'
- python: "3.3"
env: DJANGO='django>=1.10.0,<1.11.0'
env: DJANGO="django>=1.10.0,<1.11.0" REST_FRAMEWORK="djangorestframework>=3.4,<3.5"
- python: "3.3"
env: DJANGO='django>=1.9.0,<1.10.0'
env: DJANGO="django>=1.9.0,<1.10.0" REST_FRAMEWORK="djangorestframework>=3.4,<3.5"
include:
- python: "3.5"
env: W='python -W error -m' DJANGO='https://github.com/django/django/archive/master.tar.gz' REST_FRAMEWORK='djangorestframework>=3.4,<3.5'
allow_failures:
- env: DJANGO='https://github.com/django/django/archive/master.tar.gz'
- env: W='python -W error -m' DJANGO='https://github.com/django/django/archive/master.tar.gz' REST_FRAMEWORK='djangorestframework>=3.4,<3.5'
- env: DJANGO='https://github.com/django/django/archive/master.tar.gz' REST_FRAMEWORK='djangorestframework>=3.4,<3.5'
fast_finish: true
34 changes: 34 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
Version 0.15.0 (2016-09-20)
---------------------------

This is a preparatory release for a 1.0. Lots of clean-up, lots of changes,
mostly backwards compatible.

Special thanks to Ryan P Kilby (@rpkilby) for lots of hard work.

Most changes should raise a Deprecation Warning.

**Note**: if you're doing *Clever Things™* with the various filter options
— ``filter_overrides`` etc — you may run into an `AttributeError` since these
are now defined on the metaclass and not on the filter itself.
(See the discussion on #459)

Summary: Highly Recommended, but take a moment to ensure everything still works.

* Added the DRF backend. #481

* Deprecated `MethodFilter` in favour of `Filter.method` #382

* Move filter options to metaclass #459

* Added `get_filter_predicate` hook. (Allows e.g. filtering on annotated fields) #469

* Rework Ordering options into a filter #472

* Hardened all deprecations for 1.0. Please do see the `Migration Notes`__

__ https://github.com/carltongibson/django-filter/blob/develop/docs/migration.txt



Version 0.14.0 (2016-08-14)
---------------------------

Expand All @@ -15,6 +48,7 @@ Version 0.14.0 (2016-08-14)

* Various Minor Clean up issues.


Version 0.13.0 (2016-03-11)
---------------------------

Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Requirements

* Python 2.7, 3.3, 3.4, 3.5
* Django 1.8, 1.9, 1.10
* DRF 3.3 (Django 1.8 only), 3.4

Installation
------------
Expand Down
2 changes: 1 addition & 1 deletion django_filters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .filterset import FilterSet
from .filters import *

__version__ = '0.14.0'
__version__ = '0.15.0'


def parse_version(version):
Expand Down
16 changes: 16 additions & 0 deletions django_filters/compat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@

import django
from django.conf import settings


# django-crispy-forms is optional
try:
import crispy_forms
except ImportError:
crispy_forms = None

is_crispy = 'crispy_forms' in settings.INSTALLED_APPS and crispy_forms


def remote_field(field):
Expand All @@ -22,3 +32,9 @@ def remote_queryset(field):
limit_choices_to = field.get_limit_choices_to()

return model._default_manager.complex_filter(limit_choices_to)


def format_value(widget, value):
if django.VERSION >= (1, 10):
return widget.format_value(value)
return widget._format_value(value)
106 changes: 106 additions & 0 deletions django_filters/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@

from django.conf import settings as dj_settings
from django.core.signals import setting_changed
from django.utils.translation import ugettext_lazy as _

from .utils import deprecate


DEFAULTS = {
'HELP_TEXT_FILTER': True,
'HELP_TEXT_EXCLUDE': True,
'VERBOSE_LOOKUPS': {
# transforms don't need to be verbose, since their expressions are chained
'date': _('date'),
'year': _('year'),
'month': _('month'),
'day': _('day'),
'week_day': _('week day'),
'hour': _('hour'),
'minute': _('minute'),
'second': _('second'),

# standard lookups
'exact': _(''),
'iexact': _(''),
'contains': _('contains'),
'icontains': _('contains'),
'in': _('is in'),
'gt': _('is greater than'),
'gte': _('is greater than or equal to'),
'lt': _('is less than'),
'lte': _('is less than or equal to'),
'startswith': _('starts with'),
'istartswith': _('starts with'),
'endswith': _('ends with'),
'iendswith': _('ends with'),
'range': _('is in range'),
'isnull': _(''),
'regex': _('matches regex'),
'iregex': _('matches regex'),
'search': _('search'),

# postgres lookups
'contained_by': _('is contained by'),
'overlap': _('overlaps'),
'has_key': _('has key'),
'has_keys': _('has keys'),
'has_any_keys': _('has any keys'),
'trigram_similar': _('search'),
},
}


DEPRECATED_SETTINGS = [
'HELP_TEXT_FILTER',
'HELP_TEXT_EXCLUDE'
]


class Settings(object):

def __init__(self):
for setting in DEFAULTS:
value = self.get_setting(setting)
setattr(self, setting, value)

def VERBOSE_LOOKUPS():
"""
VERBOSE_LOOKUPS accepts a dictionary of {terms: verbose expressions}
or a zero-argument callable that returns a dictionary.
"""
def fget(self):
if callable(self._VERBOSE_LOOKUPS):
self._VERBOSE_LOOKUPS = self._VERBOSE_LOOKUPS()
return self._VERBOSE_LOOKUPS

def fset(self, value):
self._VERBOSE_LOOKUPS = value

return locals()
VERBOSE_LOOKUPS = property(**VERBOSE_LOOKUPS())

def get_setting(self, setting):
django_setting = 'FILTERS_%s' % setting

if setting in DEPRECATED_SETTINGS and hasattr(dj_settings, django_setting):
deprecate("The '%s' setting has been deprecated." % django_setting)

return getattr(dj_settings, django_setting, DEFAULTS[setting])

def change_setting(self, setting, value, enter, **kwargs):
if not setting.startswith('FILTERS_'):
return
setting = setting[8:] # strip 'FILTERS_'

# ensure a valid app setting is being overridden
if setting not in DEFAULTS:
return

# if exiting, refetch the value from settings.
value = value if enter else self.get_setting(setting)
setattr(self, setting, value)


settings = Settings()
setting_changed.connect(settings.change_setting)

0 comments on commit a02db39

Please sign in to comment.