Commit f7fad676 by Alex Gaynor

Correct an issue with saving tags when no tags were includded in a form.

parent 32a5bcc8
......@@ -88,6 +88,11 @@ class TaggableFormTestCase(BaseTaggingTest):
apple = Food.objects.get(name='apple')
self.assert_tags_equal(apple.tags.all(), ['green', 'red', 'yummy', 'delicious'])
self.assertEqual(Food.objects.count(), 1)
f = FoodForm({"name": "raspberry"})
raspberry = f.save()
self.assert_tags_equal(raspberry.tags.all(), [])
class SimilarityByTagTestCase(BaseTaggingTest):
def test_similarity_by_tag(self):
......@@ -105,6 +110,7 @@ class SimilarityByTagTestCase(BaseTaggingTest):
self.assertEqual(similar_objs, [pear, watermelon])
self.assertEqual(map(lambda x: x.similar_tags, similar_objs), [3, 2])
class TagReuseTestCase(BaseTaggingTest):
def test_tag_reuse(self):
apple = Food.objects.create(name="apple")
......
from functools import wraps
def parse_tags(tags):
if tags is None:
tags = ""
return [o.strip() for o in tags.split(',') if o.strip()]
def require_instance_manager(func):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment