[Python-modules-commits] [django-reversion] 01/01: New upstream version 2.0.10

Michael Fladischer fladi at moszumanska.debian.org
Thu Aug 31 19:33:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch upstream
in repository django-reversion.

commit a717e33b38654ddfe14912b093edf2a9b9972b11
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Thu Aug 31 21:20:19 2017 +0200

    New upstream version 2.0.10
---
 CHANGELOG.rst              | 18 ++++++++++++++++++
 docs/admin.rst             |  2 +-
 docs/index.rst             |  2 +-
 reversion/__init__.py      |  2 +-
 reversion/revisions.py     |  3 +++
 reversion/views.py         |  2 +-
 tests/test_app/admin.py    | 14 ++++++++++++++
 tests/test_project/urls.py |  1 +
 8 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index e4ea90a..a5ed2a7 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -3,6 +3,24 @@
 django-reversion changelog
 ==========================
 
+2.0.10 - 18/08/2017
+-------------------
+
+- Bugfix: Handling case of `None` user in request (@pawelad).
+- Documentation corrections (@danielquinn).
+- Bugfix: "invalid literal for int() with base 10: 'None'" for unversioned admin inline relations.
+
+  If, after updating, you still experience this issue, run the following in a Django shell:
+
+  .. code::
+
+      from reversion.models import Version
+      Version.objects.filter(object_id="None").delete()
+
+  **Important:** Ensure that none of your versioned models contain a string primary key where `"None"` is a valid value
+  before running this snippet!
+
+
 2.0.9 - 19/06/2017
 ------------------
 
diff --git a/docs/admin.rst b/docs/admin.rst
index 8ba6285..8085a3f 100644
--- a/docs/admin.rst
+++ b/docs/admin.rst
@@ -6,7 +6,7 @@ Admin integration
 django-reversion can be used to add rollback and recovery to your admin site.
 
 .. Warning::
-    The admin integration requires that your database engine supports transactions. This is the case for PostgreSQL, SQLite and MySQL InnoDB. If you are using MySQL MyISSAM, upgrade your database tables to InnoDB!
+    The admin integration requires that your database engine supports transactions. This is the case for PostgreSQL, SQLite and MySQL InnoDB. If you are using MySQL MyISAM, upgrade your database tables to InnoDB!
 
 
 Overview
diff --git a/docs/index.rst b/docs/index.rst
index 5f6daff..2589728 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -41,7 +41,7 @@ For more information about admin integration, see :ref:`admin`.
 Low-level API
 -------------
 
-You can the django-reversion API to build version-controlled applications. See :ref:`api`.
+You can use the django-reversion API to build version-controlled applications. See :ref:`api`.
 
 
 More information
diff --git a/reversion/__init__.py b/reversion/__init__.py
index 1196d01..e3b63c4 100644
--- a/reversion/__init__.py
+++ b/reversion/__init__.py
@@ -36,4 +36,4 @@ else:
         get_registered_models,
     )
 
-__version__ = VERSION = (2, 0, 9)
+__version__ = VERSION = (2, 0, 10)
diff --git a/reversion/revisions.py b/reversion/revisions.py
index 121ec73..fca53d0 100644
--- a/reversion/revisions.py
+++ b/reversion/revisions.py
@@ -170,6 +170,9 @@ def _follow_relations_recursive(obj):
 
 def _add_to_revision(obj, using, model_db, explicit):
     from reversion.models import Version
+    # Exit early if the object is not fully-formed.
+    if obj.pk is None:
+        return
     version_options = _get_options(obj.__class__)
     content_type = _get_content_type(obj.__class__, using)
     object_id = force_text(obj.pk)
diff --git a/reversion/views.py b/reversion/views.py
index 2057d17..68afb27 100644
--- a/reversion/views.py
+++ b/reversion/views.py
@@ -15,7 +15,7 @@ def _request_creates_revision(request):
 
 
 def _set_user_from_request(request):
-    if hasattr(request, "user") and is_authenticated(request.user) and get_user() is None:
+    if getattr(request, "user", None) and is_authenticated(request.user) and get_user() is None:
         set_user(request.user)
 
 
diff --git a/tests/test_app/admin.py b/tests/test_app/admin.py
new file mode 100644
index 0000000..c664123
--- /dev/null
+++ b/tests/test_app/admin.py
@@ -0,0 +1,14 @@
+from django.contrib import admin
+from reversion.admin import VersionAdmin
+from test_app.models import TestModel, TestModelRelated
+
+
+class TestModelAdmin(VersionAdmin):
+
+    filter_horizontal = ("related",)
+
+
+admin.site.register(TestModel, TestModelAdmin)
+
+
+admin.site.register(TestModelRelated, admin.ModelAdmin)
diff --git a/tests/test_project/urls.py b/tests/test_project/urls.py
index 910b5ae..32ddec0 100644
--- a/tests/test_project/urls.py
+++ b/tests/test_project/urls.py
@@ -1,6 +1,7 @@
 from django.conf.urls import url, include
 from django.contrib import admin
 
+admin.autodiscover()
 
 urlpatterns = [
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-reversion.git



More information about the Python-modules-commits mailing list