Hello community, here is the log from the commit of package python-django-reversion for openSUSE:Factory checked in at 2019-01-25 22:45:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-django-reversion (Old) and /work/SRC/openSUSE:Factory/.python-django-reversion.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-django-reversion" Fri Jan 25 22:45:02 2019 rev:6 rq:668406 version:3.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-django-reversion/python-django-reversion.changes 2018-11-08 09:49:26.113032991 +0100 +++ /work/SRC/openSUSE:Factory/.python-django-reversion.new.28833/python-django-reversion.changes 2019-01-25 22:45:03.235103306 +0100 @@ -1,0 +2,8 @@ +Thu Jan 24 16:37:04 UTC 2019 - Martin Herkt <9+suse@cirno.systems> + +- Update to version 3.0.3: + * Improved performance of many reversion database queries using + `EXISTS` subquery. + * Added support for Django 2.1 `view` permission. + +------------------------------------------------------------------- Old: ---- django-reversion-3.0.2.tar.gz New: ---- django-reversion-3.0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-django-reversion.spec ++++++ --- /var/tmp/diff_new_pack.KIAGcM/_old 2019-01-25 22:45:03.955102418 +0100 +++ /var/tmp/diff_new_pack.KIAGcM/_new 2019-01-25 22:45:03.959102413 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-django-reversion # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-django-reversion -Version: 3.0.2 +Version: 3.0.3 Release: 0 Summary: A Django extension that provides version control for model instances License: BSD-3-Clause ++++++ django-reversion-3.0.2.tar.gz -> django-reversion-3.0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-reversion-3.0.2/CHANGELOG.rst new/django-reversion-3.0.3/CHANGELOG.rst --- old/django-reversion-3.0.2/CHANGELOG.rst 2018-11-05 10:52:13.000000000 +0100 +++ new/django-reversion-3.0.3/CHANGELOG.rst 2019-01-24 11:20:24.000000000 +0100 @@ -3,6 +3,13 @@ django-reversion changelog ========================== +3.0.3 - 24/01/2019 +------------------ + +- Improved performance of many reversion database queries using `EXISTS` subquery (@MRigal). +- Added support for Django 2.1 `view` permission (@ofw). + + 3.0.2 - 05/11/2018 ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-reversion-3.0.2/PKG-INFO new/django-reversion-3.0.3/PKG-INFO --- old/django-reversion-3.0.2/PKG-INFO 2018-11-05 10:53:25.000000000 +0100 +++ new/django-reversion-3.0.3/PKG-INFO 2019-01-24 11:21:11.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: django-reversion -Version: 3.0.2 +Version: 3.0.3 Summary: An extension to the Django web framework that provides version control for model instances. Home-page: http://github.com/etianen/django-reversion Author: Dave Hall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-reversion-3.0.2/django_reversion.egg-info/PKG-INFO new/django-reversion-3.0.3/django_reversion.egg-info/PKG-INFO --- old/django-reversion-3.0.2/django_reversion.egg-info/PKG-INFO 2018-11-05 10:53:25.000000000 +0100 +++ new/django-reversion-3.0.3/django_reversion.egg-info/PKG-INFO 2019-01-24 11:21:11.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: django-reversion -Version: 3.0.2 +Version: 3.0.3 Summary: An extension to the Django web framework that provides version control for model instances. Home-page: http://github.com/etianen/django-reversion Author: Dave Hall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-reversion-3.0.2/reversion/__init__.py new/django-reversion-3.0.3/reversion/__init__.py --- old/django-reversion-3.0.2/reversion/__init__.py 2018-11-05 10:52:13.000000000 +0100 +++ new/django-reversion-3.0.3/reversion/__init__.py 2019-01-24 11:20:24.000000000 +0100 @@ -36,4 +36,4 @@ get_registered_models, ) -__version__ = VERSION = (3, 0, 2) +__version__ = VERSION = (3, 0, 3) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-reversion-3.0.2/reversion/admin.py new/django-reversion-3.0.3/reversion/admin.py --- old/django-reversion-3.0.2/reversion/admin.py 2018-11-05 10:52:13.000000000 +0100 +++ new/django-reversion-3.0.3/reversion/admin.py 2019-01-24 11:20:24.000000000 +0100 @@ -263,9 +263,14 @@ def history_view(self, request, object_id, extra_context=None): """Renders the history view.""" - # Check if user has change permissions for model - if not self.has_change_permission(request): - raise PermissionDenied + # Check if user has view or change permissions for model + if hasattr(self, 'has_view_or_change_permission'): # for Django >= 2.1 + if not self.has_view_or_change_permission(request): + raise PermissionDenied + else: + if not self.has_change_permission(request): + raise PermissionDenied + opts = self.model._meta action_list = [ { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-reversion-3.0.2/reversion/models.py new/django-reversion-3.0.3/reversion/models.py --- old/django-reversion-3.0.2/reversion/models.py 2018-11-05 10:52:13.000000000 +0100 +++ new/django-reversion-3.0.3/reversion/models.py 2019-01-24 11:20:24.000000000 +0100 @@ -339,7 +339,9 @@ connections[left_query.db].vendor in ("sqlite", "postgresql") ) ): - right_subquery = list(right_subquery.iterator()) + return getattr(left_query, method)(**{ + "{}__in".format(left_field_name): list(right_subquery.iterator()), + }) else: # If the left hand side is not a text field, we need to cast it. if not isinstance(left_field, (models.CharField, models.TextField)): @@ -354,7 +356,9 @@ right_subquery = right_subquery.annotate(**{ right_field_name_str: _Str(right_field_name), }).values_list(right_field_name_str, flat=True) - # All done! - return getattr(left_query, method)(**{ - "{}__in".format(left_field_name): right_subquery, - }) + right_field_name = right_field_name_str + # Use Exists if running on the same DB, it is much much faster + exist_annotation_name = "{}_annotation_str".format(right_subquery.model._meta.db_table) + right_subquery = right_subquery.filter(**{right_field_name: models.OuterRef(left_field_name)}) + left_query = left_query.annotate(**{exist_annotation_name: models.Exists(right_subquery)}) + return getattr(left_query, method)(**{exist_annotation_name: True})