Commit d401839e by Alex Gaynor

my spelling is epically bad.

parent 5c35d4f9
...@@ -7,12 +7,11 @@ class TaggableForm(forms.ModelForm): ...@@ -7,12 +7,11 @@ class TaggableForm(forms.ModelForm):
tags = forms.CharField(help_text="A comma seperated list of tags.") tags = forms.CharField(help_text="A comma seperated list of tags.")
def save(self, commit=True): def save(self, commit=True):
obj = super(TaggableForm, self).save(commit=False) obj = super(TaggableForm, self).save(commit=commit)
def save_tags(): def save_tags():
# TODO: Remove the assumption that the manager is named 'tags' # TODO: Remove the assumption that the manager is named 'tags'
obj.tags.set(*parse_tags(self.cleaned_data['tags'])) obj.tags.set(*parse_tags(self.cleaned_data['tags']))
if commit: if commit:
obj.save()
save_tags() save_tags()
else: else:
obj.save_tags = save_tags obj.save_tags = save_tags
......
...@@ -19,9 +19,9 @@ class AddTagTestCase(BaseTaggingTest): ...@@ -19,9 +19,9 @@ class AddTagTestCase(BaseTaggingTest):
self.assert_tags_equal(apple.tags.all(), ['green']) self.assert_tags_equal(apple.tags.all(), ['green'])
self.assert_tags_equal(Food.tags.all(), ['green']) self.assert_tags_equal(Food.tags.all(), ['green'])
pair = Food.objects.create(name="pair") pear = Food.objects.create(name="pear")
pair.tags.add('green') pear.tags.add('green')
self.assert_tags_equal(pair.tags.all(), ['green']) self.assert_tags_equal(pear.tags.all(), ['green'])
self.assert_tags_equal(Food.tags.all(), ['green']) self.assert_tags_equal(Food.tags.all(), ['green'])
apple.tags.add('red') apple.tags.add('red')
......
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