[Python-modules-commits] [django-taggit] 02/03: Imported Upstream version 0.21.1
Michal Cihar
nijel at moszumanska.debian.org
Tue Aug 30 10:52:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
nijel pushed a commit to branch master
in repository django-taggit.
commit 36d2236a39442427ce6d1d874f4c62c619d87955
Author: Michal Čihař <nijel at debian.org>
Date: Tue Aug 30 12:51:49 2016 +0200
Imported Upstream version 0.21.1
---
CHANGELOG.txt | 5 +++++
PKG-INFO | 9 ++++++---
django_taggit.egg-info/PKG-INFO | 9 ++++++---
docs/api.txt | 9 ---------
docs/getting_started.txt | 12 +----------
docs/index.txt | 22 +--------------------
setup.cfg | 4 ++--
setup.py | 7 +++++--
taggit/__init__.py | 2 +-
taggit/managers.py | 44 ++++++++---------------------------------
taggit/migrations/__init__.py | 21 --------------------
taggit/models.py | 34 +++++--------------------------
tests/forms.py | 14 +++++--------
tests/tests.py | 30 ++++++----------------------
tox.ini | 2 ++
15 files changed, 53 insertions(+), 171 deletions(-)
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 845f946..d49634d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,11 @@
Changelog
=========
+0.21.1 (2016-08-25)
+~~~~~~~~~~~~~~~~~~~
+ * Document supported versions of Django; fix Travis to test these versions.
+ * https://github.com/alex/django-taggit/pull/435
+
0.21.0 (2016-08-22)
~~~~~~~~~~~~~~~~~~~
* Fix form tests on Django 1.10
diff --git a/PKG-INFO b/PKG-INFO
index f9afb91..26a9a5c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-taggit
-Version: 0.21.0
+Version: 0.21.1
Summary: django-taggit is a reusable Django application for simple tagging.
Home-page: http://github.com/alex/django-taggit/tree/master
Author: Alex Gaynor
@@ -53,13 +53,16 @@ Description: django-taggit
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
+Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.7
+Classifier: Framework :: Django :: 1.8
+Classifier: Framework :: Django :: 1.9
+Classifier: Framework :: Django :: 1.10
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
-Classifier: Framework :: Django
diff --git a/django_taggit.egg-info/PKG-INFO b/django_taggit.egg-info/PKG-INFO
index f9afb91..26a9a5c 100644
--- a/django_taggit.egg-info/PKG-INFO
+++ b/django_taggit.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: django-taggit
-Version: 0.21.0
+Version: 0.21.1
Summary: django-taggit is a reusable Django application for simple tagging.
Home-page: http://github.com/alex/django-taggit/tree/master
Author: Alex Gaynor
@@ -53,13 +53,16 @@ Description: django-taggit
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
+Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.7
+Classifier: Framework :: Django :: 1.8
+Classifier: Framework :: Django :: 1.9
+Classifier: Framework :: Django :: 1.10
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
-Classifier: Framework :: Django
diff --git a/docs/api.txt b/docs/api.txt
index a69948f..ac0d8b5 100644
--- a/docs/api.txt
+++ b/docs/api.txt
@@ -106,12 +106,3 @@ make use of the ``distinct()`` method on ``QuerySets``::
You can also filter by the slug on tags. If you're using a custom ``Tag``
model you can use this API to filter on any fields it has.
-
-Aggregation
-~~~~~~~~~~~
-
-Unfortunately, due to a
-`bug in Django <http://code.djangoproject.com/ticket/10870>`_, it is not
-currently (Django < 1.6) possible to use aggregation in conjunction with ``taggit``. This is
-a `documented interaction <http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#generic-relations-and-aggregation>`_
-of generic relations (which ``taggit`` uses internally) and aggregates.
diff --git a/docs/getting_started.txt b/docs/getting_started.txt
index b7903cb..e7a7e0e 100644
--- a/docs/getting_started.txt
+++ b/docs/getting_started.txt
@@ -9,16 +9,7 @@ To get started using ``django-taggit`` simply install it with
Add ``"taggit"`` to your project's ``INSTALLED_APPS`` setting.
-Run `./manage.py syncdb` or `./manage.py migrate` if using migrations.
-
-.. note::
-
- If you are using South you'll have to add the following setting, since
- taggit uses Django migrations by default::
-
- SOUTH_MIGRATION_MODULES = {
- 'taggit': 'taggit.south_migrations',
- }
+Run `./manage.py migrate`.
And then to any model you want tagging on do the following::
@@ -36,4 +27,3 @@ And then to any model you want tagging on do the following::
If you want ``django-taggit`` to be **CASE INSENSITIVE** when looking up existing tags, you'll have to set to ``True`` the TAGGIT_CASE_INSENSITIVE setting (by default ``False``)::
TAGGIT_CASE_INSENSITIVE = True
-
diff --git a/docs/index.txt b/docs/index.txt
index 6ff51c1..7ce6bba 100644
--- a/docs/index.txt
+++ b/docs/index.txt
@@ -4,25 +4,7 @@ Welcome to django-taggit's documentation!
``django-taggit`` is a reusable Django application designed to making adding
tagging to your project easy and fun.
-``django-taggit`` works with Django 1.4.5+ and Python 2.7-3.X.
-
-.. warning::
-
- Since version 0.10.0 taggit uses South for database migrations.
- This means that users who are upgrading to 0.10.0 and up will have to fake
- the initial migration, like this::
-
- python manage.py migrate taggit --fake 0001
- python manage.py migrate
-
- Since version 0.12.0 taggit uses Django migrations by default. South users
- have to adjust their settings::
-
- SOUTH_MIGRATION_MODULES = {
- 'taggit': 'taggit.south_migrations',
- }
-
- For more information, see `south documentation`__
+``django-taggit`` works with Django 1.7+ and Python 2.7-3.X.
.. toctree::
:maxdepth: 2
@@ -41,5 +23,3 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
-
-__ https://south.readthedocs.io/en/latest/
diff --git a/setup.cfg b/setup.cfg
index 8f3c6ea..352f752 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,11 +6,11 @@ universal = 1
[flake8]
ignore = E501,E302
-exclude = south_migrations,migrations
+exclude = migrations
[isort]
forced_separate = tests,taggit
-skip = migrations,.tox,south_migrations,docs
+skip = migrations,.tox,docs
[egg_info]
tag_build =
diff --git a/setup.py b/setup.py
index bfd7452..3179b2a 100644
--- a/setup.py
+++ b/setup.py
@@ -24,16 +24,19 @@ setup(
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
+ 'Framework :: Django',
+ 'Framework :: Django :: 1.7',
+ 'Framework :: Django :: 1.8',
+ 'Framework :: Django :: 1.9',
+ 'Framework :: Django :: 1.10',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
- 'Framework :: Django',
],
include_package_data=True,
zip_safe=False,
diff --git a/taggit/__init__.py b/taggit/__init__.py
index 6eec2a7..ceeb26a 100644
--- a/taggit/__init__.py
+++ b/taggit/__init__.py
@@ -1,3 +1,3 @@
-VERSION = (0, 21, 0)
+VERSION = (0, 21, 1)
default_app_config = 'taggit.apps.TaggitAppConfig'
diff --git a/taggit/managers.py b/taggit/managers.py
index 91699a0..dc6ed72 100644
--- a/taggit/managers.py
+++ b/taggit/managers.py
@@ -1,9 +1,11 @@
from __future__ import unicode_literals
+from functools import total_ordering
from operator import attrgetter
from django import VERSION
from django.conf import settings
+from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import models, router
from django.db.models import signals
@@ -36,27 +38,10 @@ if VERSION >= (1, 9):
else:
from django.db.models.fields.related import add_lazy_relation
-
-try:
- from django.contrib.contenttypes.fields import GenericRelation
-except ImportError: # django < 1.7
- from django.contrib.contenttypes.generic import GenericRelation
-
try:
from django.db.models.query_utils import PathInfo
except ImportError: # Django < 1.8
- try:
- from django.db.models.related import PathInfo
- except ImportError:
- pass # PathInfo is not used on Django < 1.6
-
-
-def _model_name(model):
- if VERSION < (1, 6):
- return model._meta.module_name
- else:
- return model._meta.model_name
-
+ from django.db.models.related import PathInfo
class TaggableRel(ManyToManyRel):
def __init__(self, field, related_name, through, to=None):
@@ -69,7 +54,7 @@ class TaggableRel(ManyToManyRel):
self.limit_choices_to = {}
self.symmetrical = True
self.multiple = True
- self.through = None if VERSION < (1, 7) else through
+ self.through = through
self.field = field
self.through_fields = None
@@ -158,10 +143,6 @@ class _TaggableManager(models.Manager):
False,
self.prefetch_cache_name)
- # Django < 1.6 uses the previous name of query_set
- get_query_set = get_queryset
- get_prefetch_query_set = get_prefetch_queryset
-
def _lookup_kwargs(self):
return self.through.lookup_kwargs(self.instance)
@@ -462,10 +443,7 @@ class TaggableManager(RelatedField, Field):
return name, path, args, kwargs
def contribute_to_class(self, cls, name):
- if VERSION < (1, 7):
- self.name = self.column = self.attname = name
- else:
- self.set_attributes_from_name(name)
+ self.set_attributes_from_name(name)
self.model = cls
self.opts = cls._meta
@@ -565,7 +543,7 @@ class TaggableManager(RelatedField, Field):
return self.through.objects.none()
def related_query_name(self):
- return _model_name(self.model)
+ return self.model._meta.model_name
def m2m_reverse_name(self):
return _get_field(self.through, 'tag').column
@@ -608,7 +586,7 @@ class TaggableManager(RelatedField, Field):
return [("%s__content_type__in" % prefix, cts)]
def get_extra_join_sql(self, connection, qn, lhs_alias, rhs_alias):
- model_name = _model_name(self.through)
+ model_name = self.through._meta.model_name
if rhs_alias == '%s_%s' % (self.through._meta.app_label, model_name):
alias_to_join = rhs_alias
else:
@@ -629,7 +607,6 @@ class TaggableManager(RelatedField, Field):
params = content_type_ids
return extra_where, params
- # This and all the methods till the end of class are only used in django >= 1.6
def _get_mm_case_path_info(self, direct=False):
pathinfos = []
linkfield1 = _get_field(self.through, 'content_object')
@@ -714,9 +691,4 @@ def _get_subclasses(model):
return subclasses
-# `total_ordering` does not exist in Django 1.4, as such
-# we special case this import to be py3k specific which
-# is not supported by Django 1.4
-if six.PY3:
- from django.utils.functional import total_ordering
- TaggableManager = total_ordering(TaggableManager)
+TaggableManager = total_ordering(TaggableManager)
diff --git a/taggit/migrations/__init__.py b/taggit/migrations/__init__.py
index c7e346b..e69de29 100644
--- a/taggit/migrations/__init__.py
+++ b/taggit/migrations/__init__.py
@@ -1,21 +0,0 @@
-"""
-Django migrations for taggit app
-
-This package does not contain South migrations. South migrations can be found
-in the ``south_migrations`` package.
-"""
-
-SOUTH_ERROR_MESSAGE = """\n
-For South support, customize the SOUTH_MIGRATION_MODULES setting like so:
-
- SOUTH_MIGRATION_MODULES = {
- 'taggit': 'taggit.south_migrations',
- }
-"""
-
-# Ensure the user is not using Django 1.6 or below with South
-try:
- from django.db import migrations # noqa
-except ImportError:
- from django.core.exceptions import ImproperlyConfigured
- raise ImproperlyConfigured(SOUTH_ERROR_MESSAGE)
diff --git a/taggit/models.py b/taggit/models.py
index a25cf23..77ffc87 100644
--- a/taggit/models.py
+++ b/taggit/models.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
-import django
from django import VERSION
+from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import IntegrityError, models, transaction
from django.db.models.query import QuerySet
@@ -19,29 +19,6 @@ except ImportError:
return tag
-try:
- from django.contrib.contenttypes.fields import GenericForeignKey
-except ImportError: # django < 1.7
- from django.contrib.contenttypes.generic import GenericForeignKey
-
-
-try:
- atomic = transaction.atomic
-except AttributeError:
- from contextlib import contextmanager
-
- @contextmanager
- def atomic(using=None):
- sid = transaction.savepoint(using=using)
- try:
- yield
- except IntegrityError:
- transaction.savepoint_rollback(sid, using=using)
- raise
- else:
- transaction.savepoint_commit(sid, using=using)
-
-
@python_2_unicode_compatible
class TagBase(models.Model):
name = models.CharField(verbose_name=_('Name'), unique=True, max_length=100)
@@ -66,7 +43,7 @@ class TagBase(models.Model):
# Be oportunistic and try to save the tag, this should work for
# most cases ;)
try:
- with atomic(using=using):
+ with transaction.atomic(using=using):
res = super(TagBase, self).save(*args, **kwargs)
return res
except IntegrityError:
@@ -225,7 +202,6 @@ class TaggedItem(GenericTaggedItemBase, TaggedItemBase):
verbose_name = _("Tagged Item")
verbose_name_plural = _("Tagged Items")
app_label = 'taggit'
- if django.VERSION >= (1, 5):
- index_together = [
- ["content_type", "object_id"],
- ]
+ index_together = [
+ ["content_type", "object_id"],
+ ]
diff --git a/tests/forms.py b/tests/forms.py
index 8a4a453..1acbbd4 100644
--- a/tests/forms.py
+++ b/tests/forms.py
@@ -5,36 +5,32 @@ from django import VERSION, forms
from .models import (CustomPKFood, DirectCustomPKFood, DirectFood, Food,
OfficialFood)
-fields = None
-if VERSION >= (1, 6):
- fields = '__all__'
-
class FoodForm(forms.ModelForm):
class Meta:
model = Food
- fields = fields
+ fields = '__all__'
class DirectFoodForm(forms.ModelForm):
class Meta:
model = DirectFood
- fields = fields
+ fields = '__all__'
class DirectCustomPKFoodForm(forms.ModelForm):
class Meta:
model = DirectCustomPKFood
- fields = fields
+ fields = '__all__'
class CustomPKFoodForm(forms.ModelForm):
class Meta:
model = CustomPKFood
- fields = fields
+ fields = '__all__'
class OfficialFoodForm(forms.ModelForm):
class Meta:
model = OfficialFood
- fields = fields
+ fields = '__all__'
diff --git a/tests/tests.py b/tests/tests.py
index 0c634c9..eae8a4d 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
import sys
import warnings
from unittest import TestCase as UnitTestCase
+from unittest import skipIf, skipUnless
import django
import mock
@@ -25,16 +26,11 @@ from .models import (Article, Child, CustomManager, CustomPKFood,
OfficialThroughModel, Pet, Photo, TaggedCustomPK,
TaggedCustomPKFood, TaggedFood)
-from taggit.managers import TaggableManager, _model_name, _TaggableManager
+from taggit.managers import TaggableManager, _TaggableManager
from taggit.models import Tag, TaggedItem
from taggit.utils import (_related_model, _remote_field, edit_string_for_tags,
parse_tags)
-try:
- from unittest import skipIf, skipUnless
-except ImportError:
- from django.utils.unittest import skipIf, skipUnless
-
class BaseTaggingTest(object):
def assert_tags_equal(self, qs, tags, sort=True, attr="name"):
@@ -420,10 +416,8 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
# + 3 queries to create the tags.
# + 6 queries to create the intermediary things (including SELECTs, to
# make sure we don't double create.
- # + 12 on Django 1.6+ for save points.
+ # + 12 for save points.
queries = 23
- if django.VERSION < (1, 6):
- queries -= 12
self.assertNumQueries(queries, apple.tags.add, "red", "delicious", "green")
pear = self.food_model.objects.create(name="pear")
@@ -431,10 +425,8 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
# 1 query to check existing ids for sending m2m_changed signal
# + 4 queries to create the intermeidary things (including SELECTs, to
# make sure we dont't double create.
- # + 4 on Django 1.6+ for save points.
+ # + 4 for save points.
queries = 10
- if django.VERSION < (1, 6):
- queries -= 4
self.assertNumQueries(queries, pear.tags.add, "green", "delicious")
# 1 query to check existing ids for sending m2m_changed signal
@@ -564,7 +556,7 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
spot.tags.add('scary')
spike.tags.add('fluffy')
lookup_kwargs = {
- '%s__name' % _model_name(self.pet_model): 'Spot'
+ '%s__name' % self.pet_model._meta.model_name: 'Spot'
}
self.assert_tags_equal(
self.tag_model.objects.filter(**lookup_kwargs),
@@ -601,18 +593,12 @@ class TaggableManagerTestCase(BaseTaggingTestCase):
if django.VERSION >= (1, 9):
self.assertTrue(hasattr(field, 'remote_field'))
self.assertTrue(hasattr(field.remote_field, 'model'))
- elif django.VERSION >= (1, 8):
- self.assertTrue(hasattr(field, 'rel'))
- self.assertTrue(hasattr(field.rel, 'to'))
else:
self.assertTrue(hasattr(field, 'rel'))
self.assertTrue(hasattr(field.rel, 'to'))
# This API has changed in Django 1.8
# https://code.djangoproject.com/ticket/21414
- if django.VERSION >= (1, 9):
- self.assertEqual(self.food_model, field.model)
- self.assertEqual(self.tag_model, _remote_field(field).model)
if django.VERSION >= (1, 8):
self.assertEqual(self.food_model, field.model)
self.assertEqual(self.tag_model, _remote_field(field).model)
@@ -942,7 +928,6 @@ class TagStringParseTestCase(UnitTestCase):
self.assertEqual(edit_string_for_tags([a, b]), 'Cued Speech, transliterator')
- at skipIf(django.VERSION < (1, 7), "not relevant for Django < 1.7")
class DeconstructTestCase(UnitTestCase):
def test_deconstruct_kwargs_kept(self):
instance = TaggableManager(through=OfficialThroughModel, to='dummy.To')
@@ -972,7 +957,4 @@ class InheritedPrefetchTests(TestCase):
class DjangoCheckTests(UnitTestCase):
def test_django_checks(self):
- if django.VERSION >= (1, 6):
- call_command('check', tag=['models'])
- else:
- call_command('validate')
+ call_command('check', tag=['models'])
diff --git a/tox.ini b/tox.ini
index 45a7f63..96054f4 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,12 +3,14 @@ envlist =
{py27,py33,py34}-1.7.x
{py27,py33,py34,py35}-1.8.x
{py27,py34,py35}-1.9.x
+ {py27,py34,py35}-1.10.x
[testenv]
deps =
1.7.x: https://github.com/django/django/archive/stable/1.7.x.tar.gz#egg=django
1.8.x: https://github.com/django/django/archive/stable/1.8.x.tar.gz#egg=django
1.9.x: https://github.com/django/django/archive/stable/1.9.x.tar.gz#egg=django
+ 1.10.x: https://github.com/django/django/archive/stable/1.10.x.tar.gz#egg=django
commands =
make develop test
whitelist_externals = make
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-taggit.git
More information about the Python-modules-commits
mailing list