Skip to content

Commit 9d0ef2e

Browse files
committed
Merge branch 'release/1.1'
* release/1.1: bump 1.1 restore tox.ini concurrency.api.disable_concurrency is now a noop if applied to a model not under concurrency management fixes admin action bug occurring when setting `select all` checkbox (`select_across`) code clean updates docs requirements updates .gitignore add rtd docs requirements update docs back to coveralls fixes travis config fixes travis config move requirements to dedicated file add missed demo application's migration new field ConditionalVersionField updates README
2 parents 1d3254b + 97b2fc2 commit 9d0ef2e

32 files changed

+513
-284
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ docs/build/
1212
/dist
1313
/build
1414
/MANIFEST
15+
/.eggs
1516
*.egg-info
1617
*.pyc
1718
*.log

.travis.yml

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
11
language: python
22
sudo: false
3+
python:
4+
- 3.5
35

46
cache:
57
directories:
68
- $HOME/.cache/pip
79

8-
branches:
9-
only:
10-
- develop
11-
- master
12-
- feature/travis
13-
1410
services:
1511
- MySQL
1612
- PostgreSQL
1713

1814
env:
19-
# Travis give a TemplateDoesNotExist exception with django==1.6.x
20-
# - TOXENV=py27-d16-pg
21-
# - TOXENV=py27-d16-sqlite
22-
# - TOXENV=py27-d16-mysql
23-
- TOXENV=py27-d17-pg
24-
- TOXENV=py27-d17-sqlite
25-
- TOXENV=py27-d17-mysql
26-
- TOXENV=py27-d18-pg
27-
- TOXENV=py27-d18-sqlite
28-
- TOXENV=py27-d18-mysql
29-
- TOXENV=py27-d19-pg
30-
- TOXENV=py27-d19-sqlite
31-
- TOXENV=py27-d19-mysql
32-
- TOXENV=py33-d17-pg
33-
- TOXENV=py33-d17-sqlite
34-
- TOXENV=py33-d18-pg
35-
- TOXENV=py33-d18-sqlite
36-
- TOXENV=py34-d17-pg
37-
- TOXENV=py34-d17-sqlite
38-
- TOXENV=py34-d18-pg
39-
- TOXENV=py34-d18-sqlite
40-
- TOXENV=py34-d19-pg
41-
- TOXENV=py34-d19-sqlite
42-
# - TOXENV=py35-d19-pg
43-
# - TOXENV=py35-d19-sqlite
15+
- TOXENV=py27-d18-pg
16+
- TOXENV=py27-d18-sqlite
17+
- TOXENV=py27-d18-mysql
18+
- TOXENV=py27-d19-pg
19+
- TOXENV=py27-d19-sqlite
20+
- TOXENV=py27-d19-mysql
21+
22+
- TOXENV=py33-d18-pg
23+
- TOXENV=py33-d18-sqlite
24+
25+
- TOXENV=py34-d18-pg
26+
- TOXENV=py34-d18-sqlite
27+
- TOXENV=py34-d19-pg
28+
- TOXENV=py34-d19-sqlite
29+
30+
- TOXENV=py35-d18-pg
31+
- TOXENV=py35-d18-sqlite
32+
- TOXENV=py35-d19-pg
33+
- TOXENV=py35-d19-sqlite
34+
35+
- TOXENV=pypy-d18-pg
36+
- TOXENV=pypy-d18-sqlite
37+
- TOXENV=pypy-d19-pg
38+
- TOXENV=pypy-d19-sqlite
39+
4440

4541
install:
46-
- pip install tox coverage python-coveralls>=2.5 coveralls>=0.5 codecov
42+
- pip install tox "coverage<=4.0" python-coveralls>=2.5 coveralls>=0.5 codecov
4743

4844
script:
49-
- tox -e $TOXENV -- tests -vv --capture=no --cov=concurrency --cov-report=xml --cov-config=tests/.coveragerc
45+
- tox -e $TOXENV -- py.test tests -v --capture=no --cov=concurrency \
46+
--cov-report=xml --cov-config=tests/.coveragerc
5047

5148
before_success:
5249
- coverage erase
@@ -55,3 +52,12 @@ after_success:
5552
- coverage combine
5653
- coveralls
5754
- codecov
55+
56+
57+
notifications:
58+
webhooks:
59+
urls:
60+
- https://webhooks.gitter.im/e/bf3806c14c6efcff7da1
61+
on_success: always # options: [always|never|change] default: always
62+
on_failure: always # options: [always|never|change] default: always
63+
on_start: never # options: [always|never|change] default: always

CHANGES

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
Release 1.1 (13 Feb 2016)
2+
-------------------------
3+
* drop support for django<1.7
4+
* add support for pypy
5+
* new :class:`concurrency.fields.ConditionalVersionField`
6+
* new decorator :class:`concurrency.api.concurrency_disable_increment`
7+
* :class:`concurrency.api.disable_concurrency` is now a noop if applied to a model not under concurrency management
8+
9+
110
Release 1.0.1
211
-------------
312
* fixes :issue:`56` (thanks oppianmatt).
413

14+
515
Release 1.0
616
-----------
717
* **BACKWARD INCOMPATIBLE**:: dropped support for Django prior 1.6
@@ -18,6 +28,7 @@ Release 1.0
1828
* new :setting:`CONCURRECY_ENABLED` to fully disable concurrency
1929
* new :setting:`CONCURRECY_MANUAL_TRIGGERS` to disable triggers auto creation fixes :issue:`41` (thanks Naddiseo)
2030

31+
2132
Release 0.9
2233
-----------
2334
* Django 1.8 compatibility
@@ -92,6 +103,5 @@ Release 0.4.0
92103

93104
Release 0.3.2
94105
---------------------------------
95-
96106
* fixed :issue:`3` (thanks pombredanne)
97107
* fixed :issue:`1` (thanks mbrochh)

MANIFEST.in

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ include CHANGES
44
include LICENSE
55
include MANIFEST.in
66
include setup.py
7+
include tox.ini
8+
include *.py
9+
10+
exclude Makefile
11+
exclude .editorconfig
12+
exclude .tx
13+
14+
recursive-exclude .tx *
15+
16+
recursive-include docs *
717
recursive-include src *
8-
recursive-exclude src/django_concurrency.egg-info *
9-
recursive-exclude src *.py[oc]
18+
recursive-include tests *

Makefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ develop:
1212
@pip install -U pip setuptools
1313
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then pip install MySQL-python; fi"
1414
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then pip install -q psycopg2; fi"
15-
@sh -c "if [ '${DJANGO}' = '1.4.x' ]; then pip install 'django>=1.4,<1.5'; fi"
16-
@sh -c "if [ '${DJANGO}' = '1.5.x' ]; then pip install 'django>=1.5,<1.6'; fi"
17-
@sh -c "if [ '${DJANGO}' = '1.6.x' ]; then pip install 'django>=1.6,<1.7'; fi"
18-
@sh -c "if [ '${DJANGO}' = '1.7.x' ]; then pip install 'django>=1.7,<1.8'; fi"
19-
@sh -c "if [ '${DJANGO}' = '1.8.x' ]; then pip install 'django>=1.8,<1.9'; fi"
20-
@sh -c "if [ '${DJANGO}' = '1.9.x' ]; then pip install 'django>=1.9,<1.10'; fi"
21-
@sh -c "if [ '${DJANGO}' = 'last' ]; then pip install django; fi"
22-
@sh -c "if [ '${DJANGO}' = 'dev' ]; then pip install git+git://github.com/django/django.git; fi"
15+
# @sh -c "if [ '${DJANGO}' = '1.4.x' ]; then pip install 'django>=1.4,<1.5'; fi"
16+
# @sh -c "if [ '${DJANGO}' = '1.5.x' ]; then pip install 'django>=1.5,<1.6'; fi"
17+
# @sh -c "if [ '${DJANGO}' = '1.6.x' ]; then pip install 'django>=1.6,<1.7'; fi"
18+
# @sh -c "if [ '${DJANGO}' = '1.7.x' ]; then pip install 'django>=1.7,<1.8'; fi"
19+
# @sh -c "if [ '${DJANGO}' = '1.8.x' ]; then pip install 'django>=1.8,<1.9'; fi"
20+
# @sh -c "if [ '${DJANGO}' = '1.9.x' ]; then pip install 'django>=1.9,<1.10'; fi"
21+
# @sh -c "if [ '${DJANGO}' = 'last' ]; then pip install django; fi"
22+
# @sh -c "if [ '${DJANGO}' = 'dev' ]; then pip install git+git://github.com/django/django.git; fi"
2323
@pip install -e .[dev]
2424
$(MAKE) .init-db
2525

@@ -34,9 +34,16 @@ develop:
3434
test:
3535
py.test -v
3636

37+
qa:
38+
flake8 src/ tests/
39+
isort -rc src/ --check-only
40+
check-manifest
41+
42+
3743
clean:
3844
rm -fr ${BUILDDIR} dist *.egg-info .coverage coverage.xml
3945
find src -name __pycache__ -o -name "*.py?" -o -name "*.orig" -prune | xargs rm -rf
46+
find tests -name __pycache__ -o -name "*.py?" -o -name "*.orig" -prune | xargs rm -rf
4047
find src/concurrency/locale -name django.mo | xargs rm -f
4148

4249
fullclean:

README.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Django Concurrency
55

66
django-concurrency is an optimistic lock [1]_ implementation for Django.
77

8-
Supported Django versions: 1.7.x 1.8.x, 1.9rc1.
8+
Supported Django versions: 1.6.x, 1.7.x, 1.8.x, 1.9.
99

1010
It prevents users from doing concurrent editing in Django both from UI and from a
1111
django command.
@@ -46,6 +46,8 @@ Other projects that handle concurrent editing are `django-optimistic-lock`_ and
4646
* manage concurrency conflicts in admin's actions
4747
* can intercept changes performend out of the django app (ie using pgAdmin, phpMyAdmin, Toads) (using `TriggerVersionField`_)
4848
* can be disabled if needed (see `disable_concurrency`_)
49+
* `ConditionalVersionField`_ to handle complex business rules
50+
4951

5052
Links
5153
~~~~~
@@ -67,14 +69,15 @@ Links
6769
.. |master-build| image:: https://secure.travis-ci.org/saxix/django-concurrency.png?branch=master
6870
:target: http://travis-ci.org/saxix/django-concurrency/
6971

70-
.. |master-cov| image:: https://codecov.io/github/saxix/django-concurrency/coverage.svg?branch=master
71-
:target: https://codecov.io/github/saxix/django-concurrency?branch=master
72+
.. |master-cov| image:: https://coveralls.io/repos/saxix/django-concurrency/badge.svg?branch=master&service=github
73+
:target: https://coveralls.io/github/saxix/django-concurrency?branch=master
74+
7275

7376
.. |dev-build| image:: https://secure.travis-ci.org/saxix/django-concurrency.png?branch=develop
7477
:target: http://travis-ci.org/saxix/django-concurrency/
7578

76-
.. |dev-cov| image:: https://codecov.io/github/saxix/django-concurrency/coverage.svg?branch=develop
77-
:target: https://codecov.io/github/saxix/django-concurrency?branch=develop
79+
.. |dev-cov| image:: https://coveralls.io/repos/saxix/django-concurrency/badge.svg?branch=develop&service=github
80+
:target: https://coveralls.io/github/saxix/django-concurrency?branch=develop
7881

7982

8083
.. |wheel| image:: https://pypip.in/wheel/blackhole/badge.png
@@ -89,6 +92,8 @@ _list-editable: https://django-concurrency.readthedocs.org/en/latest/admin.html#
8992

9093
.. _TriggerVersionField: https://django-concurrency.readthedocs.org/en/latest/fields.html#triggerversionfield
9194

95+
.. _ConditionalVersionField: https://django-concurrency.readthedocs.org/en/latest/fields.html#conditionalversionfield
96+
9297
.. _disable_concurrency: https://django-concurrency.readthedocs.org/en/latest/api.html?#disable-concurrency
9398

9499
.. [1] http://en.wikipedia.org/wiki/Optimistic_concurrency_control

docs/api.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ concurrency on any Model.
183183
This features has been developed to be used in django commands
184184

185185

186+
.. versionchanged:: 1.1
187+
188+
Does not raise an exception if a model not under concurrency management is passed as argument.
189+
186190
examples
187191
~~~~~~~~
188192

@@ -205,6 +209,19 @@ examples
205209
deleted_version.revert()
206210
207211
212+
`concurrency_disable_increment()`
213+
---------------------------------
214+
215+
.. versionadded:: 1.1
216+
217+
218+
Context manager to temporary disable version increment.
219+
Concurrent save is still checked but no version increment is triggered,
220+
this creates 'shadow saves',
221+
222+
It accepts both a Model or an instance as target.
223+
224+
208225

209226
------------
210227
Templatetags

docs/fields.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,28 @@ example
8484
sax@: (concurrency) django-concurrency [feature/triggers*] $ ./demo/manage.py triggers create
8585
DATABASE TRIGGERS
8686
default concurrency_concurrency_triggerconcurrentmodel_u
87+
88+
89+
.. _concurrency.fields.ConditionalVersionField:
90+
91+
92+
ConditionalVersionField
93+
-----------------------
94+
95+
.. versionadded:: 1.1
96+
97+
98+
This field allow to configure which fields trigger the version increment so to limit
99+
the scope of the concurrency checks.
100+
101+
.. code-block:: python
102+
103+
class User(models.Model):
104+
version = ConditionalVersionField()
105+
username = models.CharField(...)
106+
password = models.PasswordField(...)
107+
108+
class ConcurrencyMeta:
109+
check_fields = ('username',)
110+
111+

docs/index.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Overview
1212
:target: http://travis-ci.org/saxix/django-concurrency/
1313
:alt: Test status
1414

15-
.. image:: https://img.shields.io/coveralls/saxix/django-concurrency/master.svg
16-
:target: https://coveralls.io/r/saxix/django-concurrency
15+
.. image:: https://codecov.io/github/saxix/django-concurrency/coverage.svg?branch=master
16+
:target: https://codecov.io/github/saxix/django-concurrency?branch=master
1717
:alt: Coverage
1818

1919

@@ -79,4 +79,3 @@ Links
7979

8080

8181
.. [1] http://en.wikipedia.org/wiki/Optimistic_concurrency_control
82-

docs/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ How to run the tests
3939
4040
.. code-block:: bash
4141
42-
$ pip tox
42+
$ pip install tox
4343
$ tox
4444

0 commit comments

Comments
 (0)