Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support only django-reversion >= 2.0 #76

Merged
merged 14 commits into from
Aug 25, 2016
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ build
*.db3
.pydevproject
.idea
.eggs
.eggs
.tox
.coverage
49 changes: 31 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@
# Config file for automatic testing at travis-ci.org

language: python
python:
- 3.5
sudo: false

python:
- "2.7"
- "3.4"
- "3.5"
cache:
directories:
- $HOME/.pip-accel
- $HOME/.cache/pip

env:
- DJANGO='1.8' REVERSION='1.9' EXTRA=''
- DJANGO='1.8' REVERSION='1.10' EXTRA=''
- DJANGO='1.9' REVERSION='1.10' EXTRA=''
- DJANGO='1.8' REVERSION='1.9' EXTRA='diff-match-patch'
- DJANGO='1.8' REVERSION='1.10' EXTRA='diff-match-patch'
- DJANGO='1.9' REVERSION='1.10' EXTRA='diff-match-patch'
matrix:
- TOXENV=py27-django18-dmp
- TOXENV=py27-django18
- TOXENV=py27-django19-dmp
- TOXENV=py27-django19
- TOXENV=py27-django110-dmp
- TOXENV=py27-django110
- TOXENV=py34-django18-dmp
- TOXENV=py34-django18
- TOXENV=py34-django19-dmp
- TOXENV=py34-django19
- TOXENV=py34-django110-dmp
- TOXENV=py34-django110
- TOXENV=py35-django18-dmp
- TOXENV=py35-django18
- TOXENV=py35-django19-dmp
- TOXENV=py35-django19
- TOXENV=py35-django110-dmp
- TOXENV=py35-django110

matrix:
fast_finish: true

install:
- pip install --upgrade pip
- pip install Django==$DJANGO.\*
- pip install django-reversion==$REVERSION.\*
- pip install . django-tools coveralls $EXTRA

script:
- python --version
- pip freeze
- coverage run --source=reversion_compare runtests.py
- pip install 'tox>=2.3.1' coveralls

script: COMMAND='coverage run --source=reversion_compare' tox -e$TOXENV
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


after_success:
- coverage combine
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ CONTRIBUTORS are and/or have been (alphabetic order):
Github: <https://github.com/amureki>
* Spencer, Samuel
Github: <https://github.com/LegoStormtroopr>
* Shannon, Michael
Github: <https://github.com/mshannon1123>
* C. Barrionuevo da Luz, Fabio
Github: <https://github.com/luzfcb>
* Wickström, Frank
Expand Down
1 change: 1 addition & 0 deletions README.creole
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ e.g.:
== Version compatibility ==

|= Reversion-Compare |=django-reversion |= Django |= Python
|v0.7.x | v2.0 | v1.8, v1.9 | v2.7, v3.4, v3.5
|v0.6.x | v1.9, v1.10 | v1.8, v1.9 | v2.7, v3.4, v3.5
|>=v0.5.2 | v1.9 | v1.7, v1.8 | v2.7, v3.4
|>=v0.4 | v1.8 | v1.7 | v2.7, v3.4
Expand Down
3 changes: 3 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tox
coveralls
django-tools
2 changes: 1 addition & 1 deletion reversion_compare/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# coding: utf-8

__version__ = "0.6.3"
__version__ = "0.7.0.dev0"
11 changes: 3 additions & 8 deletions reversion_compare/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,14 @@
from django.contrib import admin
try:
from django.contrib.admin.utils import unquote, quote
except ImportError: # Django < 1.7
except ImportError: # Django < 1.7 # pragma: no cover
from django.contrib.admin.util import unquote, quote
from django.core.urlresolvers import reverse
from django.http import Http404
from django.shortcuts import get_object_or_404, render_to_response
from django.utils.text import capfirst
from django.utils.translation import ugettext as _

try:
from reversion import revisions as reversion # django-reversion >= 1.10
except ImportError:
import reversion # django-reversion <= 1.9

from reversion.admin import VersionAdmin

from reversion_compare.forms import SelectDiffForm
Expand Down Expand Up @@ -111,7 +106,7 @@ def _get_action_list(self, request, object_id, extra_context=None):
args=(quote(version.object_id), version.id)),
}
for version
in self._order_version_queryset(self.revision_manager.get_for_object_reference(
in self._order_version_queryset(Version.objects.get_for_object_reference(
self.model,
object_id,
).select_related("revision__user"))
Expand Down Expand Up @@ -168,7 +163,7 @@ def compare_view(self, request, object_id, extra_context=None):

object_id = unquote(object_id) # Underscores in primary key get quoted to "_5F"
obj = get_object_or_404(self.model, pk=object_id)
queryset = self.revision_manager.get_for_object(obj)
queryset = Version.objects.get_for_object(obj)
version1 = get_object_or_404(queryset, pk=version_id1)
version2 = get_object_or_404(queryset, pk=version_id2)

Expand Down
Loading