Skip to content

Commit

Permalink
Merge pull request #117 from modlinltd/release/1.2.0
Browse files Browse the repository at this point in the history
Release/1.2.0
  • Loading branch information
asfaltboy authored May 16, 2020
2 parents 34b496b + f866234 commit 5655d19
Show file tree
Hide file tree
Showing 30 changed files with 630 additions and 420 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ tests/db.sqlite*
.DS_Store
.pytest_cache
/tests/local.db
/.venv
69 changes: 16 additions & 53 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,26 @@
language: python
sudo: false
language: python
cache: pip
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "pypy"
matrix:
include:
- python: "3.6"
env: DJANGO="Django>=1.11,<1.12"
- python: "3.6"
env: DJANGO="Django>=2.0,<2.1"
- python: "3.6"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
# - python: "3.7"
# env: DJANGO="Django>=2.0,<2.1"
# - python: "3.7"
# env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
exclude:
- python: "2.7"
env: DJANGO="Django>=2.0,<2.1"
- python: "2.7"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
- python: "3.5"
env: DJANGO="Django>=1.7,<1.8"
- python: "3.3"
env: DJANGO="Django>=1.9,<1.10"
- python: "3.3"
env: DJANGO="Django>=1.10,<1.11"
- python: "3.3"
env: DJANGO="Django>=1.11,<1.12"
- python: "3.3"
env: DJANGO="Django>=2.0,<2.1"
- python: "pypy"
env: DJANGO="Django>=2.0,<2.1"
- python: "3.3"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
- python: "3.4"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
- python: "pypy"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
- "3.6"
- "3.7"
- "3.8"
- "pypy3"

env:
global:
- PYTEST_DJANGO=pytest-django==2.9.1
matrix:
- DJANGO="Django>=1.7,<1.8"
- DJANGO="Django>=1.8,<1.9"
- DJANGO="Django>=1.9,<1.10"
- DJANGO="Django>=1.10,<1.11"
- DJANGO="Django>=1.11,<1.12"
- DJANGO="Django>=2.0,<2.1"
- DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
install:
- pip install $DJANGO
- pip install -e .[test] $PYTEST_DJANGO
script:
- coverage run -m py.test advanced_filters
- pep8 --exclude=*urls.py --exclude=*migrations advanced_filters -v
- DJANGO="1.9"
- DJANGO="1.10"
- DJANGO="1.11"
- DJANGO="2.0"
- DJANGO="2.1"
- DJANGO="2.2"
- DJANGO="3.0"

install: pip install tox-travis coveralls
script: tox
after_success:
coveralls
55 changes: 55 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,61 @@
Changelog
=========

1.2.0 - Django 3 and more
-------------------------

It's finally time to drop the dirty old rags and don some fresh colors.

Thanks to effort from multiple contributors, this version includes support
for newest Django version.

Breaking Changes
~~~~~~~~~~~~~~~~

* Add support for Django 2.2 and 3.0
* Drop support for Django < 1.9
* Drop support for Python 3.3-3.4

*django-advanced-filters now support only* **python 2.7, and 3.5 - 3.8.**

Features
~~~~~~~~

- Switch deprecated force_text to force_str (Merge 0427d11)

Bug fixes
~~~~~~~~~

- Avoid installing newer braces (Merge 0427d11)
- Allow choices sort on None fields (Merge 142ecd0)

Docs / Tests
~~~~~~~~~~~~

- Update dependencies stated in the README
- Refactor some unittest test cases into pytest (Merge 41271b7)
- Test the CleanWhiteSpacesMixin helper

Misc
~~~~

- Update requirements for new test deps matrix (Merge 0427d11)
- Replace deprecated assertEquals (Merge 41271b7)
- Replace deprecated logger.warn with warning (Merge 41271b7)
- Bump test dependencies (Merge 41271b7)
- Update python and add Django classifiers


Contributors
~~~~~~~~~~~~

- Petr Dlouhý
- Alon Raizman
- Hugo Maingonnat
- Arpit
- Pavel Savchenko


1.1.1 - CHANGELOG rendering is hard
-----------------------------------

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Pull Request Process
other developer, or if you do not have permission to do that, you may
request the reviewer to merge it for you.

Release process
---------------
Manual Release process
----------------------

1. Prepeare the changelog and amend the CHANGELOG.rst
1. Prepare the changelog and amend the CHANGELOG.rst
2. Increase the version numbers in any examples files and the README.rst
to the new version that this Pull Request would represent. The
versioning scheme we use is `SemVer <http://semver.org/>`__.
Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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>`__
info <https://www.vtiger.com/docs/creating-custom-filters>`__

.. figure:: https://raw.githubusercontent.com/modlinltd/django-advanced-filters/develop/screenshot.png
:alt: Creating via a modal
Expand All @@ -26,16 +26,16 @@ For release notes, see `Changelog <https://raw.githubusercontent.com/modlinltd/d
Requirements
============

- Django >= 1.7 (Django 1.7 - 2.1 on Python 2/3/PyPy2)
- django-braces == 1.4.0
- simplejson == 3.6.5
- Django >= 1.9 (Django 1.9 - 3.0 on Python 2/3/PyPy3)
- django-braces >= 1.4, < 1.14.0
- simplejson >= 3.6.5, < 4


Installation & Set up
=====================

1. Install from pypi: ``pip install django-advanced-filters``
2. Add both ``'advanced_filters'`` to ``INSTALLED_APPS``.
2. Add ``'advanced_filters'`` to ``INSTALLED_APPS``.
3. Add ``url(r'^advanced_filters/', include('advanced_filters.urls'))``
to your project's urlconf.
4. Run ``python manage.py syncdb`` or ``python manage.py migrate`` (for django >= 1.7)
Expand Down
2 changes: 1 addition & 1 deletion advanced_filters/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1.1'
__version__ = '1.2.0'
4 changes: 2 additions & 2 deletions advanced_filters/form_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

from django import forms

from django.utils import six
import six

logger = logging.getLogger('advanced_filters.form_helpers')

extra_spaces_pattern = re.compile('\s+')
extra_spaces_pattern = re.compile(r'\s+')


class VaryingTypeCharField(forms.CharField):
Expand Down
25 changes: 13 additions & 12 deletions advanced_filters/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from django.forms.formsets import formset_factory, BaseFormSet
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.utils.six.moves import range, reduce
from six.moves import range, reduce
from django.utils.text import capfirst

import django
Expand Down Expand Up @@ -253,17 +253,18 @@ def get_fields_from_model(self, model, fields):
"""
model_fields = {}
for field in fields:
if isinstance(field, tuple) and len(field) == 2:
field, verbose_name = field[0], field[1]
else:
try:
model_field = get_fields_from_path(model, field)[-1]
verbose_name = model_field.verbose_name
except (FieldDoesNotExist, IndexError, TypeError) as e:
logger.warn("AdvancedFilterForm: skip invalid field "
"- %s", e)
continue
model_fields[field] = verbose_name
if isinstance(field, tuple) and len(field) == 2:
field, verbose_name = field[0], field[1]
else:
try:
model_field = get_fields_from_path(model, field)[-1]
verbose_name = model_field.verbose_name
except (FieldDoesNotExist, IndexError, TypeError) as e:
logger.warning(
"AdvancedFilterForm: skip invalid field - %s", e
)
continue
model_fields[field] = verbose_name
return model_fields

def __init__(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion advanced_filters/q_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import base64
import time

from django.utils import six
import six
from django.db.models import Q
from django.core.serializers.base import SerializationError

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "admin/change_form.html" %}

{% load i18n admin_static admin_modify admin_urls %}
{% load i18n static admin_modify admin_urls %}

{% block extrastyle %}
{{ adminform.media.css }}
Expand Down
3 changes: 0 additions & 3 deletions advanced_filters/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from .test_models import *
from .test_q_serializer import *
from .test_views import *
13 changes: 13 additions & 0 deletions advanced_filters/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
from tests.factories import SalesRepFactory


@pytest.fixture
def user(db):
return SalesRepFactory()


@pytest.fixture()
def client(client, user):
client.force_login(user)
return client
10 changes: 10 additions & 0 deletions advanced_filters/tests/factories.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import factory

from tests.factories import SalesRepFactory


class AdvancedFilterFactory(factory.django.DjangoModelFactory):
model = 'customers.Client'

class Meta:
model = 'advanced_filters.AdvancedFilter'
Loading

0 comments on commit 5655d19

Please sign in to comment.