From e15dad4759e43befcfd2bb528771bc8debd79a56 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Sun, 20 Mar 2016 10:32:56 +0100 Subject: [PATCH 1/5] Docs: use README.rst exclusively * no more converting docs issues for PyPI --- README.md | 204 -------------------------------------------- README.rst | 243 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 243 insertions(+), 204 deletions(-) delete mode 100644 README.md create mode 100644 README.rst diff --git a/README.md b/README.md deleted file mode 100644 index 71fc3cc..0000000 --- a/README.md +++ /dev/null @@ -1,204 +0,0 @@ -## Django Advanced Filters - -| Branch | Build | Coverage | PyPI | Gitter | -| ------ | ----- | -------- | ---- | ------ | -| Master | [![Build Status][5]][7] | [![Coverage Status][8]][10] | [![PyPI][1]][2] | [![Gitter][3]][4] | -| Develop | [![Build Status][6]][7] | [![Coverage Status][9]][11] | 🔺 | 🔺 | - - -[1]: https://img.shields.io/pypi/pyversions/django-advanced-filters.svg -[2]: https://pypi.python.org/pypi/django-advanced-filters -[3]: https://badges.gitter.im/Join%20Chat.svg -[4]: https://gitter.im/modlinltd/django-advanced-filters?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge -[5]: https://travis-ci.org/modlinltd/django-advanced-filters.svg?branch=master -[6]: https://travis-ci.org/modlinltd/django-advanced-filters.svg?branch=develop -[7]: https://travis-ci.org/modlinltd/django-advanced-filters -[8]: https://coveralls.io/repos/modlinltd/django-advanced-filters/badge.svg?branch=master -[9]: https://coveralls.io/repos/modlinltd/django-advanced-filters/badge.svg?branch=develop -[10]: https://coveralls.io/github/modlinltd/django-advanced-filters?branch=master -[11]: https://coveralls.io/github/modlinltd/django-advanced-filters?branch=develop - - -A django ModelAdmin mixin which adds advanced filtering abilities to the admin. - -Mimics the advanced search feature in [VTiger](https://www.vtiger.com/), -[see here for more info](https://wiki.vtiger.com/index.php/Create_Custom_Filters) - -![screenshot](https://raw.githubusercontent.com/modlinltd/django-advanced-filters/develop/screenshot.png "Creating via a modal") - -For release notes, see [Changelog](https://raw.githubusercontent.com/modlinltd/django-advanced-filters/develop/CHANGELOG.md) - -## Requirements - -* Django >= 1.5 (Django 1.5 - 1.8 on Python 2/3/PyPy2) -* django-easy-select2 == 1.2.5 -* django-braces == 1.4.0 -* simplejson == 3.6.5 - - -## Installation & Set up - -1. Install from pypi: `pip install django-advanced-filters` -2. Add both `'advanced_filters'` and `'easy_select2'` to `INSTALLED_APPS`. -3. Add `url(r'^advanced_filters/', include('advanced_filters.urls'))` to your project's urlconf. -4. Run `python manage.py syncdb` - -## Integration Example - -Extending a ModelAdmin is pretty straightforward: - - class ProfileAdmin(AdminAdvancedFiltersMixin, models.ModelAdmin): - list_filter = ('name', 'language', 'ts') # simple list filters - - # select from these fields in the advanced filter creation form - advanced_filter_fields = ( - 'name', 'language', 'ts' - # even use related fields as lookup fields - 'country__name', 'posts__title', 'comments__content' - ) - -Adding a new advanced filter (see below) will display a new list filter -named "Advanced filters" which will list all the filter the currently -logged in user is allowed to use (by default only those he/she created). - -### Custom naming of fields - -Initially, each field in `advanced_filter_fields` is resolved into an actual -model field. That field's verbose_name attribute is then used as the text -of the displayed option. While uncommon, it occasionally makes sense to -use a custom name, especially when following a relationship, as the context -then changes. - -For example, when a profile admin allows filtering by a user name as well as -a sales representative name, it'll get confusing: - - class ProfileAdmin(AdminAdvancedFiltersMixin, models.ModelAdmin): - advanced_filter_fields = ('name', 'sales_rep__name') - -In this case the field options will both be named "name" (by default). - -To fix this, use custom naming: - - - class ProfileAdmin(AdminAdvancedFiltersMixin, models.ModelAdmin): - advanced_filter_fields = ('name', ('sales_rep__name', 'assigned rep')) - -Now, you will get two options, "name" and "assigned rep". - - -## Adding new advanced filters - -By default the mixin uses a template which extends django's built-in -`change_list` template. This template is based off of grapelli's -fork of this template (hence the 'grp' classes and funny looking javascript). - -The default template also uses the superb [magnificPopup](dimsemenov/Magnific-Popup) -which is currently bundled with the application. - -Regardless of the above, you can easily write your own template which uses -context variables `{{ advanced_filters }}` and -`{{ advanced_filters.formset }}`, to render the advanced filter creation form. - -## Structure - -Each advanced filter has only a couple of required fields when constructed -with the form; namely the title and a formset (consisting of a form for each -sub-query or rule of the filter query). - -Each form in the formset requires the following fields: -`field`, `operator`, `value` - -And allows the optional `negate` and `remove` fields. - -Let us go over each of the fields in a rule fieldset. - -### Field - -The list of all available fields for this specific instance of the ModelAdmin -as specific by the [`advanced_filter_fields` property.](#integration-example) - -#### The OR field - -`OR` is an additional field that is added to every rule's available fields. - -It allows constructing queries with [OR statements](https://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects). You can use it by creating an "empty" rule with this field "between" a set of 1 or more rules. - -### Operator - -Query field suffixes which specify how the `WHERE` query will be constructed. - -The currently supported are as follows: -`iexact`, `icontains`, `iregex`, `range`, `isnull`, `istrue` and `isfalse` - -For more detail on what they mean and how they function, see django's -[documentation on field lookups](https://docs.djangoproject.com/en/dev/ref/models/querysets/#field-lookups). - -### Value - -The value which the specific sub-query will be looking for, i.e the -value of the field specified above, or in django query syntax: `.filter(field=value)` - -### Negate - -A boolean (check-box) field to specify whether this rule is to be negated, -effectively making it a "exclude" sub-query. - -### Remove - -Similarly to other [django formsets](https://docs.djangoproject.com/en/dev/topics/forms/formsets/), -used to remove the formset on submit. - - -## Editing previously created advanced filters - -The `AdvancedFilterAdmin` class (a subclass of `ModelAdmin`) is provided -and registered with `AdvancedFilter` in admin.py module. - -The model's change_form template is overridden from grapelli's/django's -standard template, to mirror the add form modal as closely as possible. - -*Note:* currently, adding new filters from the ModelAdmin change page -is not supported. - -## Query Serialization - -**TODO:** write a few words on how serialization of queries is done. - - -## Model correlation - -Since version 1.0, The underlying `AdvancedFilter` model instances are tightly -coupled with a specific model (using the app_label.Name model name), -for which admin changelist they are to used and created in. - -This change has a few benefits: - -1. Admin mixin can be used with multiple `ModelAdmin` classes while performing - specific query serialization and field validation that are at the base of the - filter functionality. - -2. Allows users to edit previously created filters outside of - the context of a changelist, as we do in the [`AdvancedFilterAdmin`](#editing-previously-created-advanced-filters). - -3. Limit the `AdvancedListFilters` to limit queryset (and thus, the underlying - options) to a specified model. - -Note: Since we are at the early stages of development I have skipped the -South / 1.7 schema (new field) and data migrations (add specific model to all -existing instances of AdvancedFilter model) migrations. Though this shouldn't -be too difficult to do, if the need arises I can add migration examples. - -## Views - -The GetFieldChoices view is required to dynamically (using javascript) fetch a -list of valid field choices when creating/changing an `AdvancedFilter`. - - -## TODO - -* ~~Add more tests (specifically the admin and view parts)~~ -* ~~Add packaging (setup.py, etc...)~~ -* ~~Add edit/view functionality to the filters~~ -* Add permission user/group selection functionality to the filter form -* Allow toggling of predefined templates (grappelli / vanilla django admin), and front-end features. -* Support more (newer) python/django versions diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..2975915 --- /dev/null +++ b/README.rst @@ -0,0 +1,243 @@ +Django Advanced Filters +======================= + ++-----------+------------------+---------------------+----------+------------+ +| Branch | Build | Coverage | PyPI | Gitter | ++===========+==================+=====================+==========+============+ +| Master | |Build-Master| | |Coverage-Master| | |PyPI| | |Gitter| | ++-----------+------------------+---------------------+----------+------------+ +| Develop | |Build-Develop| | |Coverage-Develop| | | | ++-----------+------------------+---------------------+----------+------------+ + +A django ModelAdmin mixin which adds advanced filtering abilities to the +admin. + +Mimics the advanced search feature in +`VTiger `__, `see here for more +info `__ + +.. figure:: https://raw.githubusercontent.com/modlinltd/django-advanced-filters/develop/screenshot.png + :alt: Creating via a modal + :width: 768 px + + +For release notes, see `Changelog `__ + +Requirements +============ + +- Django >= 1.5 (Django 1.5 - 1.8 on Python 2/3/PyPy2) +- django-easy-select2 == 1.2.5 +- django-braces == 1.4.0 +- simplejson == 3.6.5 + +Installation & Set up +===================== + +1. Install from pypi: ``pip install django-advanced-filters`` +2. Add both ``'advanced_filters'`` and ``'easy_select2'`` to + ``INSTALLED_APPS``. +3. Add ``url(r'^advanced_filters/', include('advanced_filters.urls'))`` + to your project's urlconf. +4. Run ``python manage.py syncdb`` + +Integration Example +=================== + +Extending a ModelAdmin is pretty straightforward: + +.. code-block:: python + + class ProfileAdmin(AdminAdvancedFiltersMixin, models.ModelAdmin): + list_filter = ('name', 'language', 'ts') # simple list filters + + # select from these fields in the advanced filter creation form + advanced_filter_fields = ( + 'name', 'language', 'ts' + # even use related fields as lookup fields + 'country__name', 'posts__title', 'comments__content' + ) + +Adding a new advanced filter (see below) will display a new list filter +named "Advanced filters" which will list all the filter the currently +logged in user is allowed to use (by default only those he/she created). + +Custom naming of fields +----------------------- + +Initially, each field in ``advanced_filter_fields`` is resolved into an +actual model field. That field's verbose\_name attribute is then used as +the text of the displayed option. While uncommon, it occasionally makes +sense to use a custom name, especially when following a relationship, as +the context then changes. + +For example, when a profile admin allows filtering by a user name as +well as a sales representative name, it'll get confusing: + +.. code-block:: python + + class ProfileAdmin(AdminAdvancedFiltersMixin, models.ModelAdmin): + advanced_filter_fields = ('name', 'sales_rep__name') + +In this case the field options will both be named "name" (by default). + +To fix this, use custom naming: + +.. code-block:: python + + class ProfileAdmin(AdminAdvancedFiltersMixin, models.ModelAdmin): + advanced_filter_fields = ('name', ('sales_rep__name', 'assigned rep')) + +Now, you will get two options, "name" and "assigned rep". + +Adding new advanced filters +=========================== + +By default the mixin uses a template which extends django's built-in +``change_list`` template. This template is based off of grapelli's fork +of this template (hence the 'grp' classes and funny looking javascript). + +The default template also uses the superb +`magnificPopup `__ which is currently bundled +with the application. + +Regardless of the above, you can easily write your own template which +uses context variables ``{{ advanced_filters }}`` and +``{{ advanced_filters.formset }}``, to render the advanced filter +creation form. + +Structure +========= + +Each advanced filter has only a couple of required fields when +constructed with the form; namely the title and a formset (consisting of +a form for each sub-query or rule of the filter query). + +Each form in the formset requires the following fields: ``field``, +``operator``, ``value`` + +And allows the optional ``negate`` and ``remove`` fields. + +Let us go over each of the fields in a rule fieldset. + +Field +----- + +The list of all available fields for this specific instance of the +ModelAdmin as specific by the ```advanced_filter_fields`` +property. <#integration-example>`__ + +The OR field +~~~~~~~~~~~~ + +``OR`` is an additional field that is added to every rule's available +fields. + +It allows constructing queries with `OR +statements `__. +You can use it by creating an "empty" rule with this field "between" a +set of 1 or more rules. + +Operator +-------- + +Query field suffixes which specify how the ``WHERE`` query will be +constructed. + +The currently supported are as follows: ``iexact``, ``icontains``, +``iregex``, ``range``, ``isnull``, ``istrue`` and ``isfalse`` + +For more detail on what they mean and how they function, see django's +`documentation on field +lookups `__. + +Value +----- + +The value which the specific sub-query will be looking for, i.e the +value of the field specified above, or in django query syntax: +``.filter(field=value)`` + +Negate +------ + +A boolean (check-box) field to specify whether this rule is to be +negated, effectively making it a "exclude" sub-query. + +Remove +------ + +Similarly to other `django +formsets `__, +used to remove the formset on submit. + +Editing previously created advanced filters +=========================================== + +The ``AdvancedFilterAdmin`` class (a subclass of ``ModelAdmin``) is +provided and registered with ``AdvancedFilter`` in admin.py module. + +The model's change\_form template is overridden from grapelli's/django's +standard template, to mirror the add form modal as closely as possible. + +*Note:* currently, adding new filters from the ModelAdmin change page is +not supported. + +Query Serialization +=================== + +**TODO:** write a few words on how serialization of queries is done. + +Model correlation +================= + +Since version 1.0, The underlying ``AdvancedFilter`` model instances are +tightly coupled with a specific model (using the app\_label.Name model +name), for which admin changelist they are to used and created in. + +This change has a few benefits: + +1. Admin mixin can be used with multiple ``ModelAdmin`` classes while + performing specific query serialization and field validation that are + at the base of the filter functionality. + +2. Allows users to edit previously created filters outside of the + context of a changelist, as we do in the + ```AdvancedFilterAdmin`` <#editing-previously-created-advanced-filters>`__. + +3. Limit the ``AdvancedListFilters`` to limit queryset (and thus, the + underlying options) to a specified model. + +Note: Since we are at the early stages of development I have skipped the +South / 1.7 schema (new field) and data migrations (add specific model +to all existing instances of AdvancedFilter model) migrations. Though +this shouldn't be too difficult to do, if the need arises I can add +migration examples. + +Views +===== + +The GetFieldChoices view is required to dynamically (using javascript) +fetch a list of valid field choices when creating/changing an +``AdvancedFilter``. + +TODO +==== + +- Add permission user/group selection functionality to the filter form +- Allow toggling of predefined templates (grappelli / vanilla django + admin), and front-end features. +- Support more (newer) python/django versions + +.. |Build-Master| image:: https://travis-ci.org/modlinltd/django-advanced-filters.svg?branch=master + :target: https://travis-ci.org/modlinltd/django-advanced-filters +.. |Coverage-Master| image:: https://coveralls.io/repos/modlinltd/django-advanced-filters/badge.svg?branch=master + :target: https://coveralls.io/github/modlinltd/django-advanced-filters?branch=master +.. |PyPI| image:: https://img.shields.io/pypi/pyversions/django-advanced-filters.svg + :target: https://pypi.python.org/pypi/django-advanced-filters +.. |Gitter| image:: https://badges.gitter.im/Join%20Chat.svg + :target: https://gitter.im/modlinltd/django-advanced-filters?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge +.. |Build-Develop| image:: https://travis-ci.org/modlinltd/django-advanced-filters.svg?branch=develop + :target: https://travis-ci.org/modlinltd/django-advanced-filters +.. |Coverage-Develop| image:: https://coveralls.io/repos/modlinltd/django-advanced-filters/badge.svg?branch=develop + :target: https://coveralls.io/github/modlinltd/django-advanced-filters?branch=develop From 9625432b764af3e387fce2e952e3c2e90bad2cd5 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Sun, 20 Mar 2016 11:14:52 +0100 Subject: [PATCH 2/5] Docs: also use ReST for changelog * remove unnecessary conversion in setup.py --- CHANGELOG.md | 62 --------------------------------- CHANGELOG.rst | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 17 +++++---- 3 files changed, 104 insertions(+), 71 deletions(-) delete mode 100644 CHANGELOG.md create mode 100644 CHANGELOG.rst diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 1d77994..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,62 +0,0 @@ -# Changelog - -## 1.0.2 - A Better Future - -This release features better test coverage and support for Django 1.9. - -### Bugs - - stretch formset table to the modal container width - - toggle advanced `vendor/jquery` dir according to Django version - - retain support older Django versions - - clean up legacy tags in templates - -### Tests - - add admin views tests - - add Django 1.9 to test matrix - - other minor improvements - -### Docs - - Improve README with a newer screenshot and pretty tables for badges - -### Contributors: - - Pavel Savchenko - - Leonardo J. Caballero G - - Schuyler Duveen - -## 1.0.1 - A Public Release - -### Bugs - - proper support for py26 and py3X and different Django releases - - avoid querying all instances for choices - - resolve settings inside view and refine error handling - -### Tests - - add doctests to the `form_helpers` - - add tests for `forms` - - add test case `views.TestGetFieldChoicesView` - - setup.py/travis: add `test-reqs.txt` as extras_require - - refactor testing to use `py.test` and run `tox` from `setup.py` - - travis: use latest version of each Django release - -### Docs: - - `README`: explain what we test against - -## 1.0 - First contact - -#### Major changes -* Add a new (required) field [`AdvancedFilter.model`](README.md#model-correlation) -* Add parsing query dict into initialized formsets (allows for [editing existing instance](README.md#editing-previously-created-advanced-filters)). -* Add [`AdvancedFilterAdmin`](#editing-previously-created-advanced-filters) for actually accessing and [editing existing `AdvancedFilter` instances](README.md#editing-previously-created-advanced-filters). -* Use [Select2](https://github.com/asyncee/django-easy-select2) and an AJAX view to -dynamically populate [`field` options](README.md#fields). -* Add proper support for nested serialization of queries. - -#### Minor changes -* Implement more [`operators`](README.md#operators) (`isnull`, `istrue` and `isfalse`) -* Allow [custom verbose naming of fields in advanced_filter_fields](README.md#custom-naming-of-fields) -* Add helper methods to the model to hide (and decouple) core serialization functionality from users. -* Strip whitespace in field values validation -* Setup and packaging (`setup.py`/`MANIFEST.in`) -* Hide `QSerializer` calling logic in the model -* Allow modifying `advanced_filter_form` property (defaults to `AdvancedFilterForm`) -* Correct documentation regarding position of mixin in subclass (issue #1) diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..7164ba5 --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,96 @@ +Changelog +========= + +1.0.2 - A Better Future +----------------------- + +This release features better test coverage and support for Django 1.9. + +Bugs +~~~~ + +- stretch formset table to the modal container width +- toggle advanced ``vendor/jquery`` dir according to Django version +- retain support older Django versions +- clean up legacy tags in templates + +Tests +~~~~~ + +- add admin views tests +- add Django 1.9 to test matrix +- other minor improvements + +Docs +~~~~ + +- Improve README with a newer screenshot and pretty tables for badges + +Contributors: +~~~~~~~~~~~~~ + +- Pavel Savchenko +- Leonardo J. Caballero G +- Schuyler Duveen + +1.0.1 - A Public Release +------------------------ + +Bugs +~~~~ + +- proper support for py26 and py3X and different Django releases +- avoid querying all instances for choices +- resolve settings inside view and refine error handling + +Tests +~~~~~ + +- add doctests to the ``form_helpers`` +- add tests for ``forms`` +- add test case ``views.TestGetFieldChoicesView`` +- setup.py/travis: add ``test-reqs.txt`` as extras\_require +- refactor testing to use ``py.test`` and run ``tox`` from ``setup.py`` +- travis: use latest version of each Django release + +Docs: +~~~~~ + +- ``README``: explain what we test against + +1.0 - First contact +------------------- + +Major changes +~~~~~~~~~~~~~ + +- Add a new (required) field + ```AdvancedFilter.model`` `__ +- Add parsing query dict into initialized formsets (allows for `editing + existing + instance `__). +- Add + ```AdvancedFilterAdmin`` <#editing-previously-created-advanced-filters>`__ + for actually accessing and `editing existing ``AdvancedFilter`` + instances `__. +- Use `Select2 `__ and + an AJAX view to dynamically populate ```field`` + options `__. +- Add proper support for nested serialization of queries. + +Minor changes +~~~~~~~~~~~~~ + +- Implement more ```operators`` `__ (``isnull``, + ``istrue`` and ``isfalse``) +- Allow `custom verbose naming of fields in + advanced\_filter\_fields `__ +- Add helper methods to the model to hide (and decouple) core + serialization functionality from users. +- Strip whitespace in field values validation +- Setup and packaging (``setup.py``/``MANIFEST.in``) +- Hide ``QSerializer`` calling logic in the model +- Allow modifying ``advanced_filter_form`` property (defaults to + ``AdvancedFilterForm``) +- Correct documentation regarding position of mixin in subclass (issue + #1) diff --git a/setup.py b/setup.py index a9d4493..2cded02 100644 --- a/setup.py +++ b/setup.py @@ -30,15 +30,14 @@ def run_tests(self): # get long description from README -readme = 'README.md' -changelog = 'CHANGELOG.md' -try: - import pypandoc - README = b'%s\n%s' % (pypandoc.convert(readme, 'rst'), pypandoc.convert(changelog, 'rst')) -except ImportError: - print('PyPandoc not installed. Cannot convert README.md to rst') - with open(os.path.join(os.path.dirname(__file__), readme)) as readme: - README = readme.read() +readme = 'README.rst' +changelog = 'CHANGELOG.rst' +base = os.path.dirname(__file__) +with open(os.path.join(base, readme)) as readme: + README = readme.read() +with open(os.path.join(base, changelog)) as changelog: + CHANGELOG = changelog.read() +README = b'%s\n%s' % (README, CHANGELOG) # allow setup.py to be run from any path CUR_DIR = os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)) From f9a61ff33cab2b7bce75c1038089c33fd7df5706 Mon Sep 17 00:00:00 2001 From: Bo Jin Date: Sun, 20 Mar 2016 18:03:04 -0400 Subject: [PATCH 3/5] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2975915..8773d42 100644 --- a/README.rst +++ b/README.rst @@ -39,7 +39,7 @@ Installation & Set up ``INSTALLED_APPS``. 3. Add ``url(r'^advanced_filters/', include('advanced_filters.urls'))`` to your project's urlconf. -4. Run ``python manage.py syncdb`` +4. Run ``python manage.py syncdb`` or ``manage.py migrate --run-syncdb``(for django >= 1.9) Integration Example =================== From a17cd89a4094af25bbf3161e6af5d0c33055c262 Mon Sep 17 00:00:00 2001 From: Bo Jin Date: Sun, 20 Mar 2016 18:05:14 -0400 Subject: [PATCH 4/5] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8773d42..eab8071 100644 --- a/README.rst +++ b/README.rst @@ -39,7 +39,7 @@ Installation & Set up ``INSTALLED_APPS``. 3. Add ``url(r'^advanced_filters/', include('advanced_filters.urls'))`` to your project's urlconf. -4. Run ``python manage.py syncdb`` or ``manage.py migrate --run-syncdb``(for django >= 1.9) +4. Run ``python manage.py syncdb`` or ``manage.py migrate --run-syncdb`` (for django >= 1.9) Integration Example =================== From 441e4be420f6c10f556847afa21196590384b8f9 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Mon, 21 Mar 2016 09:30:30 +0100 Subject: [PATCH 5/5] fix(setup): use `find_packages` for required packages also * bump version to 1.0.3 and update changelog * exclude tests packages from distribution * include .rst files to avoid installation error fix #17 --- CHANGELOG.rst | 13 +++++++++++++ MANIFEST.in | 2 +- README.rst | 2 +- advanced_filters/__init__.py | 2 +- setup.py | 6 +++--- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7164ba5..2c43f5a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,19 @@ Changelog ========= +1.0.3 - The Package Fix +----------------------- + +This is a quick fix for packaging (setup.py) errors and documentation. + +Bugs +~~~~ + +- add missing Django 1.7 migrations +- README updated to mention ``manage.py migrate`` command +- Use ReST for README and CHANGELOG: avoid conversion from markdown + + 1.0.2 - A Better Future ----------------------- diff --git a/MANIFEST.in b/MANIFEST.in index db060bd..83349b8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ -include *.md +include *.rst recursive-include advanced_filters/static * recursive-include advanced_filters/templates * \ No newline at end of file diff --git a/README.rst b/README.rst index eab8071..db1474c 100644 --- a/README.rst +++ b/README.rst @@ -39,7 +39,7 @@ Installation & Set up ``INSTALLED_APPS``. 3. Add ``url(r'^advanced_filters/', include('advanced_filters.urls'))`` to your project's urlconf. -4. Run ``python manage.py syncdb`` or ``manage.py migrate --run-syncdb`` (for django >= 1.9) +4. Run ``python manage.py syncdb`` or ``python manage.py migrate`` (for django >= 1.7) Integration Example =================== diff --git a/advanced_filters/__init__.py b/advanced_filters/__init__.py index a6221b3..3f6fab6 100644 --- a/advanced_filters/__init__.py +++ b/advanced_filters/__init__.py @@ -1 +1 @@ -__version__ = '1.0.2' +__version__ = '1.0.3' diff --git a/setup.py b/setup.py index 2cded02..d435d92 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ from setuptools.command.test import test as TestCommand -from setuptools import setup +from setuptools import setup, find_packages import os import sys @@ -53,12 +53,12 @@ def run_tests(self): setup( name='django-advanced-filters', version=__version__, - packages=['advanced_filters'], url='https://github.com/modlinltd/django-advanced-filters', license='MIT', - include_package_data=True, description='A Django application for advanced admin filters', long_description=README, + packages=find_packages(exclude=['tests*', 'tests.*', '*.tests']), + include_package_data=True, install_requires=[ 'django-easy-select2==1.2.5', 'django-braces==1.4.0',