Skip to content

Commit

Permalink
Next release (#257)
Browse files Browse the repository at this point in the history
* Update README.md
  Updates Supported Django Versions section.

* Tox now only tests recent Pythons and Djangos

* Include necessary files to build docs in source tarball. Closes #250

* Fixes deprecated imports, adds `six` as requirement

* force text to prevent Python 2 unicode fun

* Added --nomigrations option to pytest
  For some reason this makes the tests work on my machine
  (thanks Baptiste!)

* Have to specify a non-breaking version of semantic-version (lol)

* Update CONTRIBUTORS.txt

* Release date

Co-authored-by: Steve Bywater <[email protected]>
Co-authored-by: Baptiste Mispelon <[email protected]>
  • Loading branch information
3 people authored Dec 30, 2019
1 parent 117c654 commit 64aa717
Show file tree
Hide file tree
Showing 24 changed files with 161 additions and 83 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ dist/
.idea
build/
venv/
.pytest_cache/
29 changes: 18 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: python
services: sqlite
services:
- sqlite
cache:
directories:
- $HOME/.cache/pip
Expand All @@ -9,21 +10,27 @@ matrix:
include:
- python: 2.7
env: TOX_ENV=py27-django111
- python: 3.4
env: TOX_ENV=py34-django111
- python: 3.4
env: TOX_ENV=py34-django20
- python: 3.5
env: TOX_ENV=py35-django111
- python: 3.5
env: TOX_ENV=py35-django20
- python: 3.6
env: TOX_ENV=py36-django111
- python: 3.6
env: TOX_ENV=py36-django20
env: TOX_ENV=py36-django22
- python: 3.6
env: TOX_ENV=py36-django30
- python: 3.7
env: TOX_ENV=py37-django111
- python: 3.7
env: TOX_ENV=py37-django22
- python: 3.7
env: TOX_ENV=py37-django30
- python: 3.8
env: TOX_ENV=py38-django111
- python: 3.8
env: TOX_ENV=py38-django22
- python: 3.8
env: TOX_ENV=py38-django30

script: tox -e $TOX_ENV

install:
- pip install pip setuptools wheel -U
- pip install tox
- pip install tox tox-travis
3 changes: 2 additions & 1 deletion CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ Direct Contributors
Other Contributors
==================

* The entire Python and Django communities for providing us the tools and desire we to build these things.
* The entire Python and Django communities for providing us the tools
and desire to build these things.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include README.md
include LICENSE
include CONTRIBUTORS.txt
recursive-include braces *.py
recursive-include docs *.rst
recursive-include docs Makefile conf.py *.rst
recursive-include tests *.py
recursive-include tests/templates *.html
include conftest.py tox.ini requirements.txt
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# django-braces

Mixins for Django's class-based views.

[![Latest Travis CI status](https://travis-ci.org/brack3t/django-braces.svg)](https://travis-ci.org/brack3t/django-braces)
Expand All @@ -25,15 +26,21 @@ Add yourself to `CONTRIBUTORS.txt` if you want.

All development dependencies are available in `requirements.txt` file.

To run the test suite, execute the following in your shell (Django install is required):
`py.test tests/ --cov=braces --cov-report=html`
To run the test suite, please install `tox` and as many Python interpreters as you'd
like to test against. Currently we test against 2.7, 3.6, 3.7, and 3.8. We recommend
using `asdf` to install various Python versions.

Once `tox` and Python(s) are installed, you can execute the entire suite by running
just the `tox` command.

Or test with `tox` if you have `tox` installed.

## Change Log

[Changelog on Read The Docs](https://django-braces.readthedocs.io/en/latest/changelog.html)

## Supported Django Versions

Our policy is that `django-braces` officially supports the current version of Django and one version each direction (e.g. 1.6.x is current, so 1.5.x, 1.6.x, and 1.7.x are all supported). There won't be any restraints on using other versions of Django, though, but it will be a "buyer beware" situation.
Our policy is that `django-braces` officially supports, and is tested on, all versions
that Django [officially supports](https://www.djangoproject.com/download/#supported-versions).
You are free to use `django-braces` with any version of Django you wish (so long as it has
class-based views) but no support will be promised.
2 changes: 1 addition & 1 deletion braces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""

__title__ = 'braces'
__version__ = '1.13.0'
__version__ = '1.14.0'
__author__ = 'Kenneth Love and Chris Jones'
__license__ = 'BSD 3-clause'
__copyright__ = 'Copyright 2013 Kenneth Love and Chris Jones'
1 change: 0 additions & 1 deletion braces/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
MessageMixin,
SuccessURLRedirectListMixin,
UserFormKwargsMixin,
_MessageAPIWrapper
)
from ._other import (
AllVerbsMixin,
Expand Down
10 changes: 7 additions & 3 deletions braces/views/_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
from django.http import (HttpResponseRedirect, HttpResponsePermanentRedirect,
Http404, HttpResponse, StreamingHttpResponse)
from django.shortcuts import resolve_url
from django.utils import six
from django.utils.encoding import force_text
try:
from django.utils.encoding import force_str as force_string
except ImportError:
from django.utils.encoding import force_text as force_string
from django.utils.timezone import now

import six


class AccessMixin(object):
"""
Expand All @@ -34,7 +38,7 @@ def get_login_url(self):
'Define {0}.login_url or settings.LOGIN_URL or override '
'{0}.get_login_url().'.format(self.__class__.__name__))

return force_text(login_url)
return force_string(login_url)

def get_redirect_field_name(self):
"""
Expand Down
3 changes: 2 additions & 1 deletion braces/views/_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from django.core.exceptions import ImproperlyConfigured
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse, HttpResponseBadRequest
from django.utils import six

import six


class JSONResponseMixin(object):
Expand Down
18 changes: 12 additions & 6 deletions braces/views/_forms.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
from functools import partial

from django.contrib import messages
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.decorators import method_decorator
from django.utils.encoding import force_text
from django.utils.functional import curry, Promise
try:
from django.utils.encoding import force_str as force_string
except ImportError:
from django.utils.encoding import force_text as force_string
from django.utils.functional import Promise
from django.views.decorators.csrf import csrf_exempt
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse

import six


class CsrfExemptMixin(object):
"""
Expand Down Expand Up @@ -73,7 +79,7 @@ class _MessageAPIWrapper(object):
def __init__(self, request):
for name in self.API:
api_fn = getattr(messages.api, name)
setattr(self, name, curry(api_fn, request))
setattr(self, name, partial(api_fn, request))


class _MessageDescriptor(object):
Expand Down Expand Up @@ -121,7 +127,7 @@ def get_form_valid_message(self):
'object.'.format(self.__class__.__name__)
)

return force_text(self.form_valid_message)
return force_string(self.form_valid_message)

def form_valid(self, form):
"""
Expand Down Expand Up @@ -166,7 +172,7 @@ def get_form_invalid_message(self):
'{0}.form_invalid_message must be a str or unicode '
'object.'.format(self.__class__.__name__))

return force_text(self.form_invalid_message)
return force_string(self.form_invalid_message)

def form_invalid(self, form):
response = super(FormInvalidMessageMixin, self).form_invalid(form)
Expand Down
7 changes: 5 additions & 2 deletions braces/views/_other.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from django.core.exceptions import ImproperlyConfigured
from django.shortcuts import redirect
from django.utils.encoding import force_text
try:
from django.utils.encoding import force_str as force_string
except ImportError:
from django.utils.encoding import force_text as force_string
try:
from django.urls import resolve
except ImportError:
Expand Down Expand Up @@ -28,7 +31,7 @@ def get_headline(self):
'{0} is missing a headline. '
'Define {0}.headline, or override '
'{0}.get_headline().'.format(self.__class__.__name__))
return force_text(self.headline)
return force_string(self.headline)


class StaticContextMixin(object):
Expand Down
25 changes: 23 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,35 @@
Changelog
=========

* :release:`1.14.0 <2019-12-30>`
* :support:`260` Fixes the goshdang Travis tests.
* :support:`250` Include documentation Makefile and conf.py in source distribution.
* :support:`246` README more accurately explains the supported Django versions.
* :release:`1.13.0 <2018-04-06>`
* :support:`243` Adds support for Python 3.7 and Django 2.1.
* :support:`244` Documentation link fix.
* :support:`236` Refines the Django and Python versions tested against.
* :support:`241` Fixes a documentation typo, "altenate" should be "alternate".
* :release:`1.12.0 <2018-04-06>`
* :support:`237` Updates for Django 2.0.
* :support:`232` Updates for Django 1.11.
* :support:`227` Use SVG in README instead of PNG.
* :support:`221` Renamed a duplicative method name.
* :support:`220` Adds a warning for cases where ``prefetch_related`` or ``select_related`` are empty in their respective mixins.
* :release:`1.11.0 <2017-02-01>`
* :bug:`215 major` Imports for 1.11 and 2.x ``reverse`` and ``reverse_lazy`` functions.
* :support:`248` Include some files necessary for testing in the source distribution.
* :feature:`228` Adds an ``object_level_permissions`` attribute to the ``PermissionRequiredMixin`` to allow for object-level permission checks instead of just view-level checks.
* :bug:`224 major` Allows ``OPTIONS`` requests to be body-less.
* :bug:`218 major` ``AccessMixin.handle_no_permission` now accepts a ``request`` parameter.
* :feature:`198` New :ref:`OrderableListMixin` allows to switch the default ordering setting from `asc` to `desc`.
* :support:`215` Imports updated for Django 2.0.
* :feature:`204` New :ref:`HeaderMixin` that allows custom headers to be set on a view.
* :release:`1.10.0 <2016-10-24>`
* :bug:`212 major` Small changes for Django 1.10 compatibility.
* :bug:`211 major` ReadTheDocs links updated.
* :bug:`209 major` Django documentation link updated.
* :release:`1.9.0 <2016-5-31>`
* :release:`1.9.0 <2016-05-31>`
* :bug:`208 major` Fixed errors from combining certain access mixins.
* :bug:`196 major` Refactor how users without permissions are handled.
* :bug:`181 major` Fixed redirect loops based on user permissions.
Expand All @@ -21,7 +42,7 @@ Changelog
* :support:`202` Fixed typo in ``PermissionsRequiredMixin`` and ``MultiplePermissionsRequiredMixin``.
* :support:`201` Fixed typo in ``SuccessURLRedirectListMixin``.
* :support:`192` Added example for ``OrderableListView``.
* :release:`1.8.1 <2015-7-12>`
* :release:`1.8.1 <2015-07-12>`
* :bug:`176` Only check time delta for authenticated users in :ref:`RecentLoginRequiredMixin`.
* :bug:`-` Changed :ref:`JsonRequestResponseMixin` docs to not use `ugettext_lazy`.
* :bug:`-` Updated tests to include Python 3.2.
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
releases_issue_uri = "https://github.com/brack3t/django-braces/issues/%s"
releases_release_uri = "https://github.com/brack3t/django-braces/tree/%s"
releases_unstable_prehistory = True
# releases_debug = True
releases_debug = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
3 changes: 2 additions & 1 deletion requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sphinx
sphinx==1.7.9
releases
semantic-version==2.6
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.13.0
current_version = 1.14.0
commit = True
tag = True

Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.0"
],
install_requires=[
"Django>=1.11.0",
"six"
],
)
4 changes: 2 additions & 2 deletions tests/compat.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
try:
from django.utils.encoding import force_text
from django.utils.encoding import force_str as force_string
except ImportError:
from django.utils.encoding import force_unicode as force_text
from django.utils.encoding import force_text as force_string

try:
from django.conf.urls import url, include
Expand Down
2 changes: 1 addition & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
'NAME': ':memory:'
}
}

Expand Down
Loading

0 comments on commit 64aa717

Please sign in to comment.