1def save(self, commit=True):
2 author = self.cleaned_data['author']
3 title = self.cleaned_data['title']
4 content = self.cleaned_data['content']
5 markdown = Markdown()
6 html = markdown.convert(content)
7 post = Post(author=author, title=title, content=content, html=html)
8 post.save()
9
10 tags_text = self.cleaned_data['tags']
11 tag_names = split_tags(tags_text)
12 for tag_name in tag_names:
13 tag_name.strip()
14 if 0 < len(tag_name) < 16:
15 tag = self.create_and_get(tag_name)
16 post.tags.add(tag)
17
18 return self.instance