diff -Nru django-taggit-0.20.1/CHANGELOG.txt django-taggit-0.20.2/CHANGELOG.txt --- django-taggit-0.20.1/CHANGELOG.txt 2016-06-23 12:23:18.000000000 +0000 +++ django-taggit-0.20.2/CHANGELOG.txt 2016-07-12 00:52:21.000000000 +0000 @@ -1,6 +1,11 @@ Changelog ========= +0.20.2 (2016-07-11) +~~~~~~~~~~~~~~~~~~~ + * Add extra_filters argument to the manager's most_common method + * https://github.com/alex/django-taggit/pull/422 + 0.20.1 (2016-06-23) ~~~~~~~~~~~~~~~~~~~ * Specify `app_label` for `Tag` and `TaggedItem` diff -Nru django-taggit-0.20.1/debian/changelog django-taggit-0.20.2/debian/changelog --- django-taggit-0.20.1/debian/changelog 2016-06-29 13:18:46.000000000 +0000 +++ django-taggit-0.20.2/debian/changelog 2016-08-01 09:42:29.000000000 +0000 @@ -1,3 +1,10 @@ +django-taggit (0.20.2-1) unstable; urgency=medium + + * New upstream release. + * Move package to python modules git and team maintenance. + + -- Michal Čihař Mon, 01 Aug 2016 11:42:29 +0200 + django-taggit (0.20.1-1) unstable; urgency=medium * New upstream release. diff -Nru django-taggit-0.20.1/debian/control django-taggit-0.20.2/debian/control --- django-taggit-0.20.1/debian/control 2016-06-21 13:12:15.000000000 +0000 +++ django-taggit-0.20.2/debian/control 2016-07-24 08:34:37.000000000 +0000 @@ -2,7 +2,7 @@ Section: python Priority: optional Maintainer: Michal Čihař -Uploaders: Python Applications Packaging Team +Uploaders: Debian Python Modules Team Build-Depends: debhelper (>= 9) Build-Depends-Indep: python (>= 2.6.6-3), python3-all, @@ -14,8 +14,8 @@ python-django, python3-django Standards-Version: 3.9.8 -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/django-taggit.git -Vcs-Git: git://anonscm.debian.org/collab-maint/django-taggit.git +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=python-modules/packages/django-taggit.git +Vcs-Git: git://anonscm.debian.org/python-modules/packages/django-taggit.git Homepage: https://github.com/alex/django-taggit X-Python-Version: >= 2.6 X-Python3-Version: >= 3.2 diff -Nru django-taggit-0.20.1/django_taggit.egg-info/PKG-INFO django-taggit-0.20.2/django_taggit.egg-info/PKG-INFO --- django-taggit-0.20.1/django_taggit.egg-info/PKG-INFO 2016-06-23 12:23:21.000000000 +0000 +++ django-taggit-0.20.2/django_taggit.egg-info/PKG-INFO 2016-07-12 00:52:24.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: django-taggit -Version: 0.20.1 +Version: 0.20.2 Summary: django-taggit is a reusable Django application for simple tagging. Home-page: http://github.com/alex/django-taggit/tree/master Author: Alex Gaynor diff -Nru django-taggit-0.20.1/PKG-INFO django-taggit-0.20.2/PKG-INFO --- django-taggit-0.20.1/PKG-INFO 2016-06-23 12:23:21.000000000 +0000 +++ django-taggit-0.20.2/PKG-INFO 2016-07-12 00:52:24.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: django-taggit -Version: 0.20.1 +Version: 0.20.2 Summary: django-taggit is a reusable Django application for simple tagging. Home-page: http://github.com/alex/django-taggit/tree/master Author: Alex Gaynor diff -Nru django-taggit-0.20.1/taggit/__init__.py django-taggit-0.20.2/taggit/__init__.py --- django-taggit-0.20.1/taggit/__init__.py 2016-06-23 12:23:18.000000000 +0000 +++ django-taggit-0.20.2/taggit/__init__.py 2016-07-12 00:52:21.000000000 +0000 @@ -1,3 +1,3 @@ -VERSION = (0, 20, 1) +VERSION = (0, 20, 2) default_app_config = 'taggit.apps.TaggitAppConfig' diff -Nru django-taggit-0.20.1/taggit/managers.py django-taggit-0.20.2/taggit/managers.py --- django-taggit-0.20.1/taggit/managers.py 2016-06-19 17:58:00.000000000 +0000 +++ django-taggit-0.20.2/taggit/managers.py 2016-07-12 00:40:28.000000000 +0000 @@ -335,8 +335,8 @@ model=self.through.tag_model(), pk_set=None, using=db, ) - def most_common(self, min_count=None): - queryset = self.get_queryset().annotate( + def most_common(self, min_count=None, extra_filters=None): + queryset = self.get_queryset(extra_filters).annotate( num_times=models.Count(self.through.tag_relname()) ).order_by('-num_times') if min_count: diff -Nru django-taggit-0.20.1/tests/tests.py django-taggit-0.20.2/tests/tests.py --- django-taggit-0.20.1/tests/tests.py 2016-06-19 17:58:00.000000000 +0000 +++ django-taggit-0.20.2/tests/tests.py 2016-07-12 00:40:28.000000000 +0000 @@ -733,6 +733,37 @@ tag_info = self.tag_model.objects.filter(officialfood__in=[apple.id, pear.id], name='green').annotate(models.Count('name')) self.assertEqual(tag_info[0].name__count, 2) + def test_most_common_extra_filters(self): + apple = self.food_model.objects.create(name='apple') + apple.tags.add('red') + apple.tags.add('green') + + orange = self.food_model.objects.create(name='orange') + orange.tags.add('orange') + orange.tags.add('red') + + pear = self.food_model.objects.create(name='pear') + pear.tags.add('green') + pear.tags.add('yellow') + + self.assert_tags_equal( + self.food_model.tags.most_common( + min_count=2, extra_filters={ + 'officialfood__name__in': ['pear', 'apple'] + })[:1], + ['green'], + sort=False + ) + + self.assert_tags_equal( + self.food_model.tags.most_common( + min_count=2, extra_filters={ + 'officialfood__name__in': ['orange', 'apple'] + })[:1], + ['red'], + sort=False + ) + class TaggableManagerInitializationTestCase(TaggableManagerTestCase): """Make sure manager override defaults and sets correctly."""