[Python-modules-commits] [django-filter] 01/05: New upstream version 1.0.4
Brian May
bam at moszumanska.debian.org
Sun Jul 2 21:42:46 UTC 2017
This is an automated email from the git hooks/post-receive script.
bam pushed a commit to branch debian/master
in repository django-filter.
commit db8ca74ce3e50e30dbfe92d902740ce4ba4708e4
Author: Brian May <bam at debian.org>
Date: Mon Jul 3 07:33:40 2017 +1000
New upstream version 1.0.4
---
CHANGES.rst | 135 ++
MANIFEST.in | 5 +-
PKG-INFO | 79 +-
README.rst | 67 +-
django_filter.egg-info/PKG-INFO | 79 +-
django_filter.egg-info/SOURCES.txt | 46 +-
django_filters/__init__.py | 10 +-
django_filters/compat.py | 54 +
django_filters/conf.py | 118 ++
django_filters/constants.py | 24 +
django_filters/exceptions.py | 9 +
django_filters/fields.py | 38 +-
django_filters/filters.py | 454 +++++--
django_filters/filterset.py | 522 ++++----
django_filters/locale/es_ES/LC_MESSAGES/django.mo | Bin 0 -> 2247 bytes
django_filters/locale/es_ES/LC_MESSAGES/django.po | 185 +++
django_filters/locale/ru/LC_MESSAGES/django.mo | Bin 0 -> 864 bytes
django_filters/locale/ru/LC_MESSAGES/django.po | 48 +
django_filters/rest_framework/__init__.py | 5 +
django_filters/rest_framework/backends.py | 104 ++
django_filters/rest_framework/filters.py | 10 +
django_filters/rest_framework/filterset.py | 51 +
.../django_filters/rest_framework/crispy_form.html | 5 +
.../django_filters/rest_framework/form.html | 6 +
.../django_filters/widgets/multiwidget.html | 1 +
django_filters/utils.py | 219 +++-
django_filters/views.py | 9 +-
django_filters/widgets.py | 88 +-
docs/assets/form.png | Bin 0 -> 13678 bytes
docs/conf.py | 16 +-
docs/dev/tests.txt | 67 +
docs/guide/install.txt | 34 +
docs/guide/migration.txt | 197 +++
docs/guide/rest_framework.txt | 189 +++
docs/guide/tips.txt | 246 ++++
docs/{ => guide}/usage.txt | 202 +--
docs/index.txt | 20 +-
docs/install.txt | 8 -
docs/ref/fields.txt | 9 +-
docs/ref/filters.txt | 366 +++++-
docs/ref/filterset.txt | 199 +--
docs/ref/settings.txt | 102 +-
docs/ref/widgets.txt | 21 +-
docs/tests.txt | 56 -
requirements/maintainer.txt | 7 +-
requirements/test-ci.txt | 7 +
requirements/test.txt | 7 +-
requirements/travis-ci.txt | 3 -
runshell.py | 7 +-
setup.cfg | 2 +-
setup.py | 21 +-
tests/__init__.pyc | Bin 156 -> 0 bytes
tests/models.py | 40 +-
tests/models.pyc | Bin 9899 -> 0 bytes
tests/rest_framework/__init__.py | 1 +
tests/rest_framework/apps.py | 8 +
tests/rest_framework/models.py | 28 +
.../rest_framework/templates/filter_template.html | 1 +
tests/rest_framework/test_backends.py | 206 +++
tests/rest_framework/test_filters.py | 15 +
tests/rest_framework/test_filterset.py | 45 +
tests/rest_framework/test_integration.py | 401 ++++++
tests/settings.py | 23 +-
tests/tags | 1339 ++++++++++++++++++++
tests/test_conf.py | 142 +++
tests/test_fields.py | 66 +-
tests/test_fields.pyc | Bin 7374 -> 0 bytes
tests/test_filtering.py | 597 ++++++---
tests/test_filtering.pyc | Bin 85692 -> 0 bytes
tests/test_filters.py | 595 +++++++--
tests/test_filters.pyc | Bin 37952 -> 0 bytes
tests/test_filterset.py | 481 ++++---
tests/test_filterset.pyc | Bin 44817 -> 0 bytes
tests/test_forms.py | 177 +--
tests/test_forms.pyc | Bin 19175 -> 0 bytes
tests/test_utils.py | 224 +++-
tests/test_views.py | 30 +
tests/test_views.pyc | Bin 4760 -> 0 bytes
tests/test_widgets.py | 155 ++-
tests/test_widgets.pyc | Bin 6252 -> 0 bytes
tests/urls.py | 4 +-
tests/urls.pyc | Bin 635 -> 0 bytes
82 files changed, 7278 insertions(+), 1457 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index ed3eb04..eedf3b6 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,138 @@
+Version 1.0.4 (2017-05-19)
+--------------------------
+
+Quick fix for verbose_field_name issue from 1.0.3 (#722)
+
+
+Version 1.0.3 (2017-05-16)
+--------------------------
+
+Improves compatibility with Django REST Framework schema generation.
+
+See the `1.0.3 Milestone`__ for full details.
+
+__ https://github.com/carltongibson/django-filter/milestone/13?closed=1
+
+
+
+Version 1.0.2 (2017-03-20)
+--------------------------
+
+Updates for compatibility with Django 1.11 and Django REST Framework 3.6.
+
+Adds CI testing against Python 3.6
+
+See the `1.0.2 Milestone`__ for full details.
+
+__ https://github.com/carltongibson/django-filter/milestone/12?closed=1
+
+
+Version 1.0.1 (2016-11-28)
+--------------------------
+
+Small release to ease compatibility with DRF:
+
+* #568 Adds ``rest_framework`` to the ``django_filters`` namespace to allow single
+ ``import django_filters` usage.
+* A number of small updates to the docs
+
+
+Version 1.0 (2016-11-17)
+------------------------
+
+This release removes all the deprecated code from 0.14 and 0.15 for 1.0 #480.
+
+Please see the `Migration Notes`__ for details of how to migrate.
+Stick with 0.15.3 if you're not ready to update.
+
+__ https://github.com/carltongibson/django-filter/blob/1.0.0/docs/guide/migration.txt
+
+The release includes a number of small fixes and documentation updates.
+
+See the `1.0 Milestone`__ for full details.
+
+__ https://github.com/carltongibson/django-filter/milestone/8?closed=1
+
+
+Version 0.15.3 (2016-10-17)
+---------------------------
+
+Adds compatibility for DRF (3.5+) get_schema_fields filter backend
+introspection.
+
+* #492 Port get_schema_fields from DRF
+
+
+Version 0.15.2 (2016-09-29)
+---------------------------
+
+* #507 Fix compatibility issue when not using the DTL
+
+
+Version 0.15.1 (2016-09-28)
+---------------------------
+
+A couple of quick bug fixes:
+
+* #496 OrderingFilter not working with Select widget
+
+* #498 DRF Backend Templates not loading
+
+
+
+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/1.0.0/docs/guide/migration.txt
+
+
+
+Version 0.14.0 (2016-08-14)
+---------------------------
+
+* Confirmed support for Django 1.10.
+
+* Add support for filtering on DurationField (new in Django 1.8).
+
+* Fix UUIDFilter import issue
+
+* Improve FieldLookupError message
+
+* Add filters_for_model to improve extensibility
+
+* Fix limit_choices_to behavior with callables
+
+* Fix distinct behavior for range filters
+
+* Various Minor Clean up issues.
+
+
Version 0.13.0 (2016-03-11)
---------------------------
diff --git a/MANIFEST.in b/MANIFEST.in
index 13d96d3..47f4970 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -8,4 +8,7 @@ recursive-include docs *
recursive-include requirements *
recursive-include tests *
recursive-include django_filters/locale *
-prune docs/_build
\ No newline at end of file
+recursive-include django_filters/templates *.html
+prune docs/_build
+global-exclude __pycache__
+global-exclude *.py[co]
diff --git a/PKG-INFO b/PKG-INFO
index d3d1c10..24f976a 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,38 +1,54 @@
Metadata-Version: 1.1
Name: django-filter
-Version: 0.13.0
+Version: 1.0.4
Summary: Django-filter is a reusable Django application for allowing users to filter querysets dynamically.
-Home-page: http://github.com/carltongibson/django-filter/tree/master
+Home-page: https://github.com/carltongibson/django-filter/tree/master
Author: Carlton Gibson
Author-email: carlton.gibson at noumenal.es
License: BSD
Description: Django Filter
=============
- Django-filter is a reusable Django application for allowing users to filter
- querysets dynamically.
+ Django-filter is a reusable Django application allowing users to declaratively
+ add dynamic ``QuerySet`` filtering from URL parameters.
Full documentation on `read the docs`_.
.. image:: https://travis-ci.org/carltongibson/django-filter.svg?branch=master
:target: https://travis-ci.org/carltongibson/django-filter
+ .. image:: https://codecov.io/gh/carltongibson/django-filter/branch/develop/graph/badge.svg
+ :target: https://codecov.io/gh/carltongibson/django-filter
+
+ .. image:: https://badge.fury.io/py/django-filter.svg
+ :target: http://badge.fury.io/py/django-filter
+
+
Requirements
------------
- * Python 2.7, 3.2, 3.3, 3.4, 3.5
- * Django 1.8, 1.9
+ * **Python**: 2.7, 3.3, 3.4, 3.5
+ * **Django**: 1.8, 1.9, 1.10, 1.11
+ * **DRF**: 3.5
Installation
------------
- Install using pip::
+ Install using pip:
+
+ .. code-block:: sh
pip install django-filter
- Or clone the repo and add to your PYTHONPATH::
+ Then add ``'django_filters'`` to your ``INSTALLED_APPS``.
+
+ .. code-block:: python
+
+ INSTALLED_APPS = [
+ ...
+ 'django_filters',
+ ]
- git clone git at github.com:carltongibson/django-filter.git
Usage
-----
@@ -40,7 +56,9 @@ Description: Django Filter
Django-filter can be used for generating interfaces similar to the Django
admin's ``list_filter`` interface. It has an API very similar to Django's
``ModelForms``. For example, if you had a Product model you could have a
- filterset for it with the code::
+ filterset for it with the code:
+
+ .. code-block:: python
import django_filters
@@ -50,26 +68,36 @@ Description: Django Filter
fields = ['name', 'price', 'manufacturer']
- And then in your view you could do::
+ And then in your view you could do:
+
+ .. code-block:: python
def product_list(request):
filter = ProductFilter(request.GET, queryset=Product.objects.all())
return render(request, 'my_app/template.html', {'filter': filter})
- Django-filters additionally supports specifying FilterSet fields using a
- dictionary to specify filters with lookup types::
- import django_filters
+ Usage with Django REST Framework
+ --------------------------------
- class ProductFilter(django_filters.FilterSet):
+ Django-filter provides a custom ``FilterSet`` and filter backend for use with
+ Django REST Framework.
+
+ To use this adjust your import to use
+ ``django_filters.rest_framework.FilterSet``.
+
+ .. code-block:: python
+
+ from django_filters import rest_framework as filters
+
+ class ProductFilter(filters.FilterSet):
class Meta:
model = Product
- fields = {'name': ['exact', 'icontains'],
- 'price': ['exact', 'gte', 'lte'],
- }
+ fields = ('category', 'in_stock')
+
+
+ For more details see the `DRF integration docs`_.
- The filters will be available as 'name', 'name__icontains', 'price',
- 'price__gte', and 'price__lte' in the above example.
Support
-------
@@ -77,8 +105,9 @@ Description: Django Filter
If you have questions about usage or development you can join the
`mailing list`_.
- .. _`read the docs`: https://django-filter.readthedocs.org/en/latest/
+ .. _`read the docs`: https://django-filter.readthedocs.io/en/develop/
.. _`mailing list`: http://groups.google.com/group/django-filter
+ .. _`DRF integration docs`: https://django-filter.readthedocs.io/en/develop/guide/rest_framework.html
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
@@ -86,11 +115,17 @@ Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
+Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.8
+Classifier: Framework :: Django :: 1.9
+Classifier: Framework :: Django :: 1.10
+Classifier: Framework :: Django :: 1.11
Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
Classifier: Framework :: Django
diff --git a/README.rst b/README.rst
index 19ec278..f1be14c 100644
--- a/README.rst
+++ b/README.rst
@@ -1,30 +1,46 @@
Django Filter
=============
-Django-filter is a reusable Django application for allowing users to filter
-querysets dynamically.
+Django-filter is a reusable Django application allowing users to declaratively
+add dynamic ``QuerySet`` filtering from URL parameters.
Full documentation on `read the docs`_.
.. image:: https://travis-ci.org/carltongibson/django-filter.svg?branch=master
:target: https://travis-ci.org/carltongibson/django-filter
+.. image:: https://codecov.io/gh/carltongibson/django-filter/branch/develop/graph/badge.svg
+ :target: https://codecov.io/gh/carltongibson/django-filter
+
+.. image:: https://badge.fury.io/py/django-filter.svg
+ :target: http://badge.fury.io/py/django-filter
+
+
Requirements
------------
-* Python 2.7, 3.2, 3.3, 3.4, 3.5
-* Django 1.8, 1.9
+* **Python**: 2.7, 3.3, 3.4, 3.5
+* **Django**: 1.8, 1.9, 1.10, 1.11
+* **DRF**: 3.5
Installation
------------
-Install using pip::
+Install using pip:
+
+.. code-block:: sh
pip install django-filter
-Or clone the repo and add to your PYTHONPATH::
+Then add ``'django_filters'`` to your ``INSTALLED_APPS``.
+
+.. code-block:: python
+
+ INSTALLED_APPS = [
+ ...
+ 'django_filters',
+ ]
- git clone git at github.com:carltongibson/django-filter.git
Usage
-----
@@ -32,7 +48,9 @@ Usage
Django-filter can be used for generating interfaces similar to the Django
admin's ``list_filter`` interface. It has an API very similar to Django's
``ModelForms``. For example, if you had a Product model you could have a
-filterset for it with the code::
+filterset for it with the code:
+
+.. code-block:: python
import django_filters
@@ -42,26 +60,36 @@ filterset for it with the code::
fields = ['name', 'price', 'manufacturer']
-And then in your view you could do::
+And then in your view you could do:
+
+.. code-block:: python
def product_list(request):
filter = ProductFilter(request.GET, queryset=Product.objects.all())
return render(request, 'my_app/template.html', {'filter': filter})
-Django-filters additionally supports specifying FilterSet fields using a
-dictionary to specify filters with lookup types::
- import django_filters
+Usage with Django REST Framework
+--------------------------------
- class ProductFilter(django_filters.FilterSet):
+Django-filter provides a custom ``FilterSet`` and filter backend for use with
+Django REST Framework.
+
+To use this adjust your import to use
+``django_filters.rest_framework.FilterSet``.
+
+.. code-block:: python
+
+ from django_filters import rest_framework as filters
+
+ class ProductFilter(filters.FilterSet):
class Meta:
model = Product
- fields = {'name': ['exact', 'icontains'],
- 'price': ['exact', 'gte', 'lte'],
- }
+ fields = ('category', 'in_stock')
+
+
+For more details see the `DRF integration docs`_.
-The filters will be available as 'name', 'name__icontains', 'price',
-'price__gte', and 'price__lte' in the above example.
Support
-------
@@ -69,5 +97,6 @@ Support
If you have questions about usage or development you can join the
`mailing list`_.
-.. _`read the docs`: https://django-filter.readthedocs.org/en/latest/
+.. _`read the docs`: https://django-filter.readthedocs.io/en/develop/
.. _`mailing list`: http://groups.google.com/group/django-filter
+.. _`DRF integration docs`: https://django-filter.readthedocs.io/en/develop/guide/rest_framework.html
diff --git a/django_filter.egg-info/PKG-INFO b/django_filter.egg-info/PKG-INFO
index d3d1c10..24f976a 100644
--- a/django_filter.egg-info/PKG-INFO
+++ b/django_filter.egg-info/PKG-INFO
@@ -1,38 +1,54 @@
Metadata-Version: 1.1
Name: django-filter
-Version: 0.13.0
+Version: 1.0.4
Summary: Django-filter is a reusable Django application for allowing users to filter querysets dynamically.
-Home-page: http://github.com/carltongibson/django-filter/tree/master
+Home-page: https://github.com/carltongibson/django-filter/tree/master
Author: Carlton Gibson
Author-email: carlton.gibson at noumenal.es
License: BSD
Description: Django Filter
=============
- Django-filter is a reusable Django application for allowing users to filter
- querysets dynamically.
+ Django-filter is a reusable Django application allowing users to declaratively
+ add dynamic ``QuerySet`` filtering from URL parameters.
Full documentation on `read the docs`_.
.. image:: https://travis-ci.org/carltongibson/django-filter.svg?branch=master
:target: https://travis-ci.org/carltongibson/django-filter
+ .. image:: https://codecov.io/gh/carltongibson/django-filter/branch/develop/graph/badge.svg
+ :target: https://codecov.io/gh/carltongibson/django-filter
+
+ .. image:: https://badge.fury.io/py/django-filter.svg
+ :target: http://badge.fury.io/py/django-filter
+
+
Requirements
------------
- * Python 2.7, 3.2, 3.3, 3.4, 3.5
- * Django 1.8, 1.9
+ * **Python**: 2.7, 3.3, 3.4, 3.5
+ * **Django**: 1.8, 1.9, 1.10, 1.11
+ * **DRF**: 3.5
Installation
------------
- Install using pip::
+ Install using pip:
+
+ .. code-block:: sh
pip install django-filter
- Or clone the repo and add to your PYTHONPATH::
+ Then add ``'django_filters'`` to your ``INSTALLED_APPS``.
+
+ .. code-block:: python
+
+ INSTALLED_APPS = [
+ ...
+ 'django_filters',
+ ]
- git clone git at github.com:carltongibson/django-filter.git
Usage
-----
@@ -40,7 +56,9 @@ Description: Django Filter
Django-filter can be used for generating interfaces similar to the Django
admin's ``list_filter`` interface. It has an API very similar to Django's
``ModelForms``. For example, if you had a Product model you could have a
- filterset for it with the code::
+ filterset for it with the code:
+
+ .. code-block:: python
import django_filters
@@ -50,26 +68,36 @@ Description: Django Filter
fields = ['name', 'price', 'manufacturer']
- And then in your view you could do::
+ And then in your view you could do:
+
+ .. code-block:: python
def product_list(request):
filter = ProductFilter(request.GET, queryset=Product.objects.all())
return render(request, 'my_app/template.html', {'filter': filter})
- Django-filters additionally supports specifying FilterSet fields using a
- dictionary to specify filters with lookup types::
- import django_filters
+ Usage with Django REST Framework
+ --------------------------------
- class ProductFilter(django_filters.FilterSet):
+ Django-filter provides a custom ``FilterSet`` and filter backend for use with
+ Django REST Framework.
+
+ To use this adjust your import to use
+ ``django_filters.rest_framework.FilterSet``.
+
+ .. code-block:: python
+
+ from django_filters import rest_framework as filters
+
+ class ProductFilter(filters.FilterSet):
class Meta:
model = Product
- fields = {'name': ['exact', 'icontains'],
- 'price': ['exact', 'gte', 'lte'],
- }
+ fields = ('category', 'in_stock')
+
+
+ For more details see the `DRF integration docs`_.
- The filters will be available as 'name', 'name__icontains', 'price',
- 'price__gte', and 'price__lte' in the above example.
Support
-------
@@ -77,8 +105,9 @@ Description: Django Filter
If you have questions about usage or development you can join the
`mailing list`_.
- .. _`read the docs`: https://django-filter.readthedocs.org/en/latest/
+ .. _`read the docs`: https://django-filter.readthedocs.io/en/develop/
.. _`mailing list`: http://groups.google.com/group/django-filter
+ .. _`DRF integration docs`: https://django-filter.readthedocs.io/en/develop/guide/rest_framework.html
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
@@ -86,11 +115,17 @@ Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
+Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.8
+Classifier: Framework :: Django :: 1.9
+Classifier: Framework :: Django :: 1.10
+Classifier: Framework :: Django :: 1.11
Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
Classifier: Framework :: Django
diff --git a/django_filter.egg-info/SOURCES.txt b/django_filter.egg-info/SOURCES.txt
index 034c49c..0796015 100644
--- a/django_filter.egg-info/SOURCES.txt
+++ b/django_filter.egg-info/SOURCES.txt
@@ -14,6 +14,9 @@ django_filter.egg-info/not-zip-safe
django_filter.egg-info/top_level.txt
django_filters/__init__.py
django_filters/compat.py
+django_filters/conf.py
+django_filters/constants.py
+django_filters/exceptions.py
django_filters/fields.py
django_filters/filters.py
django_filters/filterset.py
@@ -25,47 +28,62 @@ django_filters/locale/de/LC_MESSAGES/django.mo
django_filters/locale/de/LC_MESSAGES/django.po
django_filters/locale/es_AR/LC_MESSAGES/django.mo
django_filters/locale/es_AR/LC_MESSAGES/django.po
+django_filters/locale/es_ES/LC_MESSAGES/django.mo
+django_filters/locale/es_ES/LC_MESSAGES/django.po
django_filters/locale/fr/LC_MESSAGES/django.mo
django_filters/locale/fr/LC_MESSAGES/django.po
django_filters/locale/pl/LC_MESSAGES/django.mo
django_filters/locale/pl/LC_MESSAGES/django.po
+django_filters/locale/ru/LC_MESSAGES/django.mo
+django_filters/locale/ru/LC_MESSAGES/django.po
django_filters/locale/zh_CN/LC_MESSAGES/django.po
+django_filters/rest_framework/__init__.py
+django_filters/rest_framework/backends.py
+django_filters/rest_framework/filters.py
+django_filters/rest_framework/filterset.py
+django_filters/templates/django_filters/rest_framework/crispy_form.html
+django_filters/templates/django_filters/rest_framework/form.html
+django_filters/templates/django_filters/widgets/multiwidget.html
docs/.DS_Store
docs/Makefile
docs/conf.py
docs/index.txt
-docs/install.txt
docs/make.bat
-docs/tests.txt
-docs/usage.txt
+docs/assets/form.png
+docs/dev/tests.txt
+docs/guide/install.txt
+docs/guide/migration.txt
+docs/guide/rest_framework.txt
+docs/guide/tips.txt
+docs/guide/usage.txt
docs/ref/fields.txt
docs/ref/filters.txt
docs/ref/filterset.txt
docs/ref/settings.txt
docs/ref/widgets.txt
requirements/maintainer.txt
+requirements/test-ci.txt
requirements/test.txt
-requirements/travis-ci.txt
tests/__init__.py
-tests/__init__.pyc
tests/models.py
-tests/models.pyc
tests/settings.py
+tests/tags
+tests/test_conf.py
tests/test_fields.py
-tests/test_fields.pyc
tests/test_filtering.py
-tests/test_filtering.pyc
tests/test_filters.py
-tests/test_filters.pyc
tests/test_filterset.py
-tests/test_filterset.pyc
tests/test_forms.py
-tests/test_forms.pyc
tests/test_utils.py
tests/test_views.py
-tests/test_views.pyc
tests/test_widgets.py
-tests/test_widgets.pyc
tests/urls.py
-tests/urls.pyc
+tests/rest_framework/__init__.py
+tests/rest_framework/apps.py
+tests/rest_framework/models.py
+tests/rest_framework/test_backends.py
+tests/rest_framework/test_filters.py
+tests/rest_framework/test_filterset.py
+tests/rest_framework/test_integration.py
+tests/rest_framework/templates/filter_template.html
tests/templates/tests/book_filter.html
\ No newline at end of file
diff --git a/django_filters/__init__.py b/django_filters/__init__.py
index eeb0868..9d57b0f 100644
--- a/django_filters/__init__.py
+++ b/django_filters/__init__.py
@@ -1,9 +1,17 @@
# flake8: noqa
from __future__ import absolute_import
+from .constants import STRICTNESS
from .filterset import FilterSet
from .filters import *
-__version__ = '0.13.0'
+# We make the `rest_framework` module available without an additional import.
+# If DRF is not installed we simply set None.
+try:
+ from . import rest_framework
+except ImportError:
+ rest_framework = None
+
+__version__ = '1.0.4'
def parse_version(version):
diff --git a/django_filters/compat.py b/django_filters/compat.py
index 41e76ec..69945c4 100644
--- a/django_filters/compat.py
+++ b/django_filters/compat.py
@@ -1,6 +1,38 @@
+from __future__ import absolute_import
+
import django
+from django.conf import settings
+from django.utils.timezone import make_aware as make_aware_orig
+
+try:
+ from django.forms.utils import pretty_name
+except ImportError: # Django 1.8
+ from django.forms.forms import pretty_name
+
+# django-crispy-forms is optional
+try:
+ import crispy_forms
+except ImportError:
+ crispy_forms = None
+
+def is_crispy():
+ return 'crispy_forms' in settings.INSTALLED_APPS and crispy_forms
+
+
+# coreapi is optional (Note that uritemplate is a dependency of coreapi)
+# Fixes #525 - cannot simply import from rest_framework.compat, due to
+# import issues w/ django-guardian.
+try:
+ import coreapi
+except ImportError:
+ coreapi = None
+
+try:
+ import coreschema
+except ImportError:
+ coreschema = None
def remote_field(field):
"""
@@ -15,3 +47,25 @@ def remote_model(field):
if django.VERSION >= (1, 9):
return remote_field(field).model
return remote_field(field).to
+
+
+def remote_queryset(field):
+ model = remote_model(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)
+
+
+
+def make_aware(value, timezone, is_dst):
+ """is_dst was added for 1.9"""
+ if django.VERSION >= (1, 9):
+ return make_aware_orig(value, timezone, is_dst)
+ else:
+ return make_aware_orig(value, timezone)
diff --git a/django_filters/conf.py b/django_filters/conf.py
new file mode 100644
index 0000000..c672c30
--- /dev/null
+++ b/django_filters/conf.py
@@ -0,0 +1,118 @@
+
+from __future__ import absolute_import
+
+from django.conf import settings as dj_settings
+from django.core.signals import setting_changed
+from django.utils.translation import ugettext_lazy as _
+
+from .constants import STRICTNESS
+from .utils import deprecate
+
+
+DEFAULTS = {
+ 'DISABLE_HELP_TEXT': False,
+ 'HELP_TEXT_FILTER': True,
+ 'HELP_TEXT_EXCLUDE': True,
+
+ # empty/null choices
+ 'EMPTY_CHOICE_LABEL': '---------',
+ 'NULL_CHOICE_LABEL': None,
+ 'NULL_CHOICE_VALUE': 'null',
+
+ 'STRICTNESS': STRICTNESS.RETURN_NO_RESULTS,
+
+ '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',
+]
+
+
+def is_callable(value):
+ # check for callables, except types
+ return callable(value) and not isinstance(value, type)
+
+
+class Settings(object):
+
+ def __getattr__(self, name):
+ if name not in DEFAULTS:
+ msg = "'%s' object has no attribute '%s'"
+ raise AttributeError(msg % (self.__class__.__name__, name))
+
+ value = self.get_setting(name)
+
+ if is_callable(value):
+ value = value()
+
+ # Cache the result
+ setattr(self, name, value)
+ return value
+
+ 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, delete value to repopulate
+ if enter:
+ setattr(self, setting, value)
+ else:
+ delattr(self, setting)
+
+
+settings = Settings()
+setting_changed.connect(settings.change_setting)
diff --git a/django_filters/constants.py b/django_filters/constants.py
new file mode 100644
index 0000000..2f5fb3d
--- /dev/null
+++ b/django_filters/constants.py
@@ -0,0 +1,24 @@
+
+ALL_FIELDS = '__all__'
+
... 10404 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-filter.git
More information about the Python-modules-commits
mailing list