[Python-modules-commits] [django-taggit] 02/04: Imported Upstream version 0.21.0

Michal Cihar nijel at moszumanska.debian.org
Tue Aug 23 06:57:08 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 9ea8041d85a3391795f77a4d65277bc59a1ffa64
Author: Michal Čihař <nijel at debian.org>
Date:   Tue Aug 23 08:52:38 2016 +0200

    Imported Upstream version 0.21.0
---
 CHANGELOG.txt                                   | 11 +++++
 PKG-INFO                                        |  4 +-
 README.rst                                      |  2 +-
 django_taggit.egg-info/PKG-INFO                 |  4 +-
 django_taggit.egg-info/SOURCES.txt              |  3 --
 docs/admin.txt                                  | 38 +++++++++++++---
 docs/external_apps.txt                          | 24 +++++-----
 taggit/__init__.py                              |  2 +-
 taggit/south_migrations/0001_initial.py         | 60 -------------------------
 taggit/south_migrations/0002_unique_tagnames.py | 43 ------------------
 taggit/south_migrations/__init__.py             |  0
 tests/tests.py                                  | 41 ++++++-----------
 tox.ini                                         |  6 +--
 13 files changed, 77 insertions(+), 161 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 617f879..845f946 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,17 @@
 Changelog
 =========
 
+0.21.0 (2016-08-22)
+~~~~~~~~~~~~~~~~~~~
+ * Fix form tests on Django 1.10
+  * https://github.com/alex/django-taggit/pull/433
+ * Address list_display and fieldsets in admin docs
+  * https://github.com/alex/django-taggit/pull/429
+ * external_apps.txt improvements
+  * https://github.com/alex/django-taggit/pull/428
+ * Remove support for Django 1.4-1.6, again.
+  * https://github.com/alex/django-taggit/pull/427
+
 0.20.2 (2016-07-11)
 ~~~~~~~~~~~~~~~~~~~
  * Add extra_filters argument to the manager's most_common method
diff --git a/PKG-INFO b/PKG-INFO
index 33aaea8..f9afb91 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-taggit
-Version: 0.20.2
+Version: 0.21.0
 Summary: django-taggit is a reusable Django application for simple tagging.
 Home-page: http://github.com/alex/django-taggit/tree/master
 Author: Alex Gaynor
@@ -44,7 +44,7 @@ Description: django-taggit
         
         Tags will show up for you automatically in forms and the admin.
         
-        ``django-taggit`` requires Django 1.4.5 or greater.
+        ``django-taggit`` requires Django 1.7 or greater.
         
         For more info check out the `documentation <https://django-taggit.readthedocs.io/en/latest/>`_.  And for questions about usage or
         development you can contact the
diff --git a/README.rst b/README.rst
index 5e4c949..21be1d3 100644
--- a/README.rst
+++ b/README.rst
@@ -36,7 +36,7 @@ Then you can use the API like so:
 
 Tags will show up for you automatically in forms and the admin.
 
-``django-taggit`` requires Django 1.4.5 or greater.
+``django-taggit`` requires Django 1.7 or greater.
 
 For more info check out the `documentation <https://django-taggit.readthedocs.io/en/latest/>`_.  And for questions about usage or
 development you can contact the
diff --git a/django_taggit.egg-info/PKG-INFO b/django_taggit.egg-info/PKG-INFO
index 33aaea8..f9afb91 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.20.2
+Version: 0.21.0
 Summary: django-taggit is a reusable Django application for simple tagging.
 Home-page: http://github.com/alex/django-taggit/tree/master
 Author: Alex Gaynor
@@ -44,7 +44,7 @@ Description: django-taggit
         
         Tags will show up for you automatically in forms and the admin.
         
-        ``django-taggit`` requires Django 1.4.5 or greater.
+        ``django-taggit`` requires Django 1.7 or greater.
         
         For more info check out the `documentation <https://django-taggit.readthedocs.io/en/latest/>`_.  And for questions about usage or
         development you can contact the
diff --git a/django_taggit.egg-info/SOURCES.txt b/django_taggit.egg-info/SOURCES.txt
index 263689b..dbe021e 100644
--- a/django_taggit.egg-info/SOURCES.txt
+++ b/django_taggit.egg-info/SOURCES.txt
@@ -60,9 +60,6 @@ taggit/locale/zh_Hans/LC_MESSAGES/django.po
 taggit/migrations/0001_initial.py
 taggit/migrations/0002_auto_20150616_2121.py
 taggit/migrations/__init__.py
-taggit/south_migrations/0001_initial.py
-taggit/south_migrations/0002_unique_tagnames.py
-taggit/south_migrations/__init__.py
 tests/__init__.py
 tests/custom_parser.py
 tests/forms.py
diff --git a/docs/admin.txt b/docs/admin.txt
index 35f3c71..b0826ae 100644
--- a/docs/admin.txt
+++ b/docs/admin.txt
@@ -2,13 +2,39 @@ Using tags in the admin
 =======================
 
 By default if you have a :class:`TaggableManager` on your model it will show up
-in the admin, just as it will in any other form.  One important thing to note
-is that you *cannot* include a :class:`TaggableManager` in
-:attr:`ModelAdmin.list_display`, if you do you'll see an exception that looks
+in the admin, just as it will in any other form.
+
+If you are specifying :attr:`ModelAdmin.fieldsets`, include the name
+of the :class:`TaggableManager` as a field::
+
+    fieldsets = (
+        (None, {'fields': ('tags')}),
+    )
+
+Including tags in :attr:`ModelAdmin.list_display`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+One important thing to note is that you *cannot* include a :class:`TaggableManager` 
+in :attr:`ModelAdmin.list_display`. If you do you'll see an exception that looks
 like::
 
-    AttributeError: 'TaggableManager' object has no attribute 'flatchoices'
+    AttributeError: '_TaggableManager' object has no attribute 'name'
+
+This is for the same reason that you cannot include a :class:`ManyToManyField`:
+it would result in an unreasonable number of queries being executed.
+
+If you want to show tags in :attr:`ModelAdmin.list_display`, you can add a
+custom display method to the :class:`ModelAdmin`, using ``prefetch_related`` to
+minimize queries::
+
+    class MyModelAdmin(admin.ModelAdmin):
+        list_display = ['tag_list']
+    
+        def get_queryset(self, request):
+            return super(MyModelAdmin, self).get_queryset(request).prefetch_related('tags')
+
+        def tag_list(self, obj):
+            return u", ".join(o.name for o in obj.tags.all())
 
-This is for the same reason that you cannot include a :class:`ManyToManyField`,
-it would result in an unreasonable number of queries being executed.  If you really would like to add it, you can read the
+For details, see the
 `Django documentation <http://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display>`_.
diff --git a/docs/external_apps.txt b/docs/external_apps.txt
index 1d29d53..959d8c9 100644
--- a/docs/external_apps.txt
+++ b/docs/external_apps.txt
@@ -14,21 +14,25 @@ of interest.
 If you have an application that you'd like to see listed here, simply fork
 ``taggit`` on `github`__, add it to this list, and send a pull request.
 
- * ``django-taggit-suggest``: Provides support for defining keyword and regular
-   expression rules for suggesting new tags for content.  This used to be
-   available at ``taggit.contrib.suggest``.  Available on `github`__.
- * ``django-taggit-templatetags``: Provides several templatetags, including one
-   for tag clouds, to expose various ``taggit`` APIs directly to templates.
-   Available on `github`__.
+
  * ``django-taggit-helpers``: Makes it easier to work with admin pages of models
    associated with ``taggit`` tags by adding helper classes: ``TaggitCounter``,
    ``TaggitListFilter``, ``TaggitStackedInline``, ``TaggitTabularInline``.
    Available on `github`__.
  * ``django-taggit-labels``: Provides a clickable label widget for the
    Django admin for user friendly selection from managed tag sets.
+ * ``django-taggit-serializer``: Adds functionality for using ``taggit`` with
+   ``django-rest-framework``. Available on `github`__.
+ * ``django-taggit-suggest``: Provides support for defining keyword and regular
+   expression rules for suggesting new tags for content.  This used to be
+   available at ``taggit.contrib.suggest``.  Available on `github`__.
+ * ``django-taggit-templatetags``: Provides several templatetags, including one
+   for tag clouds, to expose various ``taggit`` APIs directly to templates.
+   Available on `github`__.
 
-__ http://github.com/alex/django-taggit
-__ http://github.com/frankwiles/django-taggit-suggest
-__ http://github.com/feuervogel/django-taggit-templatetags
-__ http://github.com/mfcovington/django-taggit-helpers
+__ https://github.com/alex/django-taggit
+__ https://github.com/mfcovington/django-taggit-helpers
 __ https://github.com/bennylope/django-taggit-labels
+__ https://github.com/glemmaPaul/django-taggit-serializer
+__ https://github.com/frankwiles/django-taggit-suggest
+__ https://github.com/feuervogel/django-taggit-templatetags
diff --git a/taggit/__init__.py b/taggit/__init__.py
index ff6c048..6eec2a7 100644
--- a/taggit/__init__.py
+++ b/taggit/__init__.py
@@ -1,3 +1,3 @@
-VERSION = (0, 20, 2)
+VERSION = (0, 21, 0)
 
 default_app_config = 'taggit.apps.TaggitAppConfig'
diff --git a/taggit/south_migrations/0001_initial.py b/taggit/south_migrations/0001_initial.py
deleted file mode 100644
index 6808f38..0000000
--- a/taggit/south_migrations/0001_initial.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-class Migration(SchemaMigration):
-
-    def forwards(self, orm):
-        # Adding model 'Tag'
-        db.create_table('taggit_tag', (
-            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
-            ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
-            ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=100)),
-        ))
-        db.send_create_signal('taggit', ['Tag'])
-
-        # Adding model 'TaggedItem'
-        db.create_table('taggit_taggeditem', (
-            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
-            ('tag', self.gf('django.db.models.fields.related.ForeignKey')(related_name='taggit_taggeditem_items', to=orm['taggit.Tag'])),
-            ('object_id', self.gf('django.db.models.fields.IntegerField')(db_index=True)),
-            ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(related_name='taggit_taggeditem_tagged_items', to=orm['contenttypes.ContentType'])),
-        ))
-        db.send_create_signal('taggit', ['TaggedItem'])
-
-
-    def backwards(self, orm):
-        # Deleting model 'Tag'
-        db.delete_table('taggit_tag')
-
-        # Deleting model 'TaggedItem'
-        db.delete_table('taggit_taggeditem')
-
-
-    models = {
-        'contenttypes.contenttype': {
-            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
-            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
-        },
-        'taggit.tag': {
-            'Meta': {'object_name': 'Tag'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'})
-        },
-        'taggit.taggeditem': {
-            'Meta': {'object_name': 'TaggedItem'},
-            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
-            'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
-        }
-    }
-
-    complete_apps = ['taggit']
diff --git a/taggit/south_migrations/0002_unique_tagnames.py b/taggit/south_migrations/0002_unique_tagnames.py
deleted file mode 100644
index d68ea10..0000000
--- a/taggit/south_migrations/0002_unique_tagnames.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- coding: utf-8 -*-
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-class Migration(SchemaMigration):
-
-    def forwards(self, orm):
-        # Adding unique constraint on 'Tag', fields ['name']
-        db.create_unique('taggit_tag', ['name'])
-
-
-    def backwards(self, orm):
-        # Removing unique constraint on 'Tag', fields ['name']
-        db.delete_unique('taggit_tag', ['name'])
-
-
-    models = {
-        'contenttypes.contenttype': {
-            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
-            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
-        },
-        'taggit.tag': {
-            'Meta': {'object_name': 'Tag'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
-            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'})
-        },
-        'taggit.taggeditem': {
-            'Meta': {'object_name': 'TaggedItem'},
-            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
-            'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
-        }
-    }
-
-    complete_apps = ['taggit']
diff --git a/taggit/south_migrations/__init__.py b/taggit/south_migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/tests.py b/tests/tests.py
index 4575f51..0c634c9 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -45,16 +45,11 @@ class BaseTaggingTest(object):
         self.assertEqual(got, tags)
 
     def _get_form_str(self, form_str):
-        if django.VERSION >= (1, 3):
-            form_str %= {
-                "help_start": '<span class="helptext">',
-                "help_stop": "</span>"
-            }
-        else:
-            form_str %= {
-                "help_start": "",
-                "help_stop": ""
-            }
+        form_str %= {
+            "help_start": '<span class="helptext">',
+            "help_stop": "</span>",
+            "required": "required" if django.VERSION >= (1, 10) else "",
+        }
         return form_str
 
     def assertFormRenders(self, form, html):
@@ -785,8 +780,8 @@ class TaggableFormTestCase(BaseTaggingTestCase):
         self.assertEqual(list(self.form_class.base_fields), ['name', 'tags'])
 
         f = self.form_class({'name': 'apple', 'tags': 'green, red, yummy'})
-        self.assertFormRenders(f, """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" value="apple" maxlength="50" /></td></tr>
-<tr><th><label for="id_tags">Tags:</label></th><td><input type="text" name="tags" value="green, red, yummy" id="id_tags" /><br />%(help_start)sA comma-separated list of tags.%(help_stop)s</td></tr>""")
+        self.assertFormRenders(f, """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" value="apple" maxlength="50" %(required)s /></td></tr>
+<tr><th><label for="id_tags">Tags:</label></th><td><input type="text" name="tags" value="green, red, yummy" id="id_tags" %(required)s /><br />%(help_start)sA comma-separated list of tags.%(help_stop)s</td></tr>""")
         f.save()
         apple = self.food_model.objects.get(name='apple')
         self.assert_tags_equal(apple.tags.all(), ['green', 'red', 'yummy'])
@@ -801,18 +796,18 @@ class TaggableFormTestCase(BaseTaggingTestCase):
         self.assertFalse(f.is_valid())
 
         f = self.form_class(instance=apple)
-        self.assertFormRenders(f, """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" value="apple" maxlength="50" /></td></tr>
-<tr><th><label for="id_tags">Tags:</label></th><td><input type="text" name="tags" value="delicious, green, red, yummy" id="id_tags" /><br />%(help_start)sA comma-separated list of tags.%(help_stop)s</td></tr>""")
+        self.assertFormRenders(f, """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" value="apple" maxlength="50" %(required)s /></td></tr>
+<tr><th><label for="id_tags">Tags:</label></th><td><input type="text" name="tags" value="delicious, green, red, yummy" id="id_tags" %(required)s /><br />%(help_start)sA comma-separated list of tags.%(help_stop)s</td></tr>""")
 
         apple.tags.add('has,comma')
         f = self.form_class(instance=apple)
-        self.assertFormRenders(f, """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" value="apple" maxlength="50" /></td></tr>
-<tr><th><label for="id_tags">Tags:</label></th><td><input type="text" name="tags" value=""has,comma", delicious, green, red, yummy" id="id_tags" /><br />%(help_start)sA comma-separated list of tags.%(help_stop)s</td></tr>""")
+        self.assertFormRenders(f, """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" value="apple" maxlength="50" %(required)s /></td></tr>
+<tr><th><label for="id_tags">Tags:</label></th><td><input type="text" name="tags" value=""has,comma", delicious, green, red, yummy" id="id_tags" %(required)s /><br />%(help_start)sA comma-separated list of tags.%(help_stop)s</td></tr>""")
 
         apple.tags.add('has space')
         f = self.form_class(instance=apple)
-        self.assertFormRenders(f, """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" value="apple" maxlength="50" /></td></tr>
-<tr><th><label for="id_tags">Tags:</label></th><td><input type="text" name="tags" value=""has space", "has,comma", delicious, green, red, yummy" id="id_tags" /><br />%(help_start)sA comma-separated list of tags.%(help_stop)s</td></tr>""")
+        self.assertFormRenders(f, """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" value="apple" maxlength="50" %(required)s /></td></tr>
+<tr><th><label for="id_tags">Tags:</label></th><td><input type="text" name="tags" value=""has space", "has,comma", delicious, green, red, yummy" id="id_tags" %(required)s /><br />%(help_start)sA comma-separated list of tags.%(help_stop)s</td></tr>""")
 
     def test_formfield(self):
         tm = TaggableManager(verbose_name='categories', help_text='Add some categories', blank=True)
@@ -957,16 +952,6 @@ class DeconstructTestCase(UnitTestCase):
         self.assertEqual('dummy.To', _related_model(_remote_field(new_instance)))
 
 
- at skipUnless(django.VERSION < (1, 7), "test only applies to 1.6 and below")
-class SouthSupportTests(TestCase):
-    def test_import_migrations_module(self):
-        try:
-            from taggit.migrations import __doc__  # noqa
-        except ImproperlyConfigured as e:
-            exception = e
-        self.assertIn("SOUTH_MIGRATION_MODULES", exception.args[0])
-
-
 class InheritedPrefetchTests(TestCase):
 
     def test_inherited_tags_with_prefetch(self):
diff --git a/tox.ini b/tox.ini
index a31a77d..45a7f63 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,15 +1,11 @@
 [tox]
 envlist =
-    py27-1.4.x
-    {py27,py33,py34}-{1.5.x,1.6.x,1.7.x}
+    {py27,py33,py34}-1.7.x
     {py27,py33,py34,py35}-1.8.x
     {py27,py34,py35}-1.9.x
 
 [testenv]
 deps =
-    1.4.x: https://github.com/django/django/archive/stable/1.4.x.tar.gz#egg=django
-    1.5.x: https://github.com/django/django/archive/stable/1.5.x.tar.gz#egg=django
-    1.6.x: https://github.com/django/django/archive/stable/1.6.x.tar.gz#egg=django
     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

-- 
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