# Path: blog/models.py
# class Post(models.Model):
#     """文章的数据模型"""
#     title = models.CharField(max_length=128)
#     slug = models.SlugField(unique=True)
#     creation_time = models.DateTimeField(auto_now_add=True)
#     modification_time = models.DateTimeField(auto_now=True)
#     body_markdown = models.TextField()
#     body_html = models.TextField()
#     author = models.ForeignKey('auth.User')
#     categories = models.ManyToManyField(Category)
#     tags = models.ManyToManyField(Tag)
# 
#     def save(self, force_insert=False, force_update=False, using=None,
#              update_fields=None):
#         super(Post, self).save(force_insert, force_update, using, update_fields)
#         try:
#             ping_google()
#         except Exception:
#             pass
# 
#     def get_absolute_url(self):
#         from django.core.urlresolvers import reverse
#         return reverse('post', args=[self.slug])
# 
#     def __str__(self):
#         return self.title
# 
# class Category(models.Model):
#     """分类的数据模型"""
#     category = models.CharField(max_length=256, unique=True)
# 
#     def __str__(self):
#         return self.category
# 
# class Tag(models.Model):
#     """标签的数据模型"""
#     tag = models.CharField(max_length=256, unique=True)
# 
#     def __str__(self):
#         return self.tag


from django import forms
from django.forms.widgets import CheckboxSelectMultiple
from blog.models import Post, Category, Tag
        labels = {
            'title': '标题',
            'slug': '缩略名',
            'categories': '分类',
            'tags': '标签',
            'body_markdown': '内容',
        }
        help_texts = {
            'title': '您的文章标题',
            'slug': '缩略名(slug)是文章标题的URL友好型版本',
            'tags': '使用标签将更具体的关键字与您的文章关联起来',
            'categories': '使用类别按主题对您的文章进行分组',
            'body_markdown': '使用Markdown语法编辑文章',
        }
        error_messages = {
            'title': {
                'required': '标题不能为空',
            },
            'slug': {
                'required': 'slug不能为空',
                'invalid': 'slug无效',
            },
            'body_markdown': {
                'required': '文章内容不能为空',
            },
        }

class CategoryForm(forms.ModelForm):
    """"分类表单"""
    class Meta:

# Path: blog/models.py
# class Post(models.Model):
#     """文章的数据模型"""
#     title = models.CharField(max_length=128)
#     slug = models.SlugField(unique=True)
#     creation_time = models.DateTimeField(auto_now_add=True)
#     modification_time = models.DateTimeField(auto_now=True)
#     body_markdown = models.TextField()
#     body_html = models.TextField()
#     author = models.ForeignKey('auth.User')
#     categories = models.ManyToManyField(Category)
#     tags = models.ManyToManyField(Tag)
# 
#     def save(self, force_insert=False, force_update=False, using=None,
#              update_fields=None):
#         super(Post, self).save(force_insert, force_update, using, update_fields)
#         try:
#             ping_google()
#         except Exception:
#             pass
# 
#     def get_absolute_url(self):
#         from django.core.urlresolvers import reverse
#         return reverse('post', args=[self.slug])
# 
#     def __str__(self):
#         return self.title
# 
# class Category(models.Model):
#     """分类的数据模型"""
#     category = models.CharField(max_length=256, unique=True)
# 
#     def __str__(self):
#         return self.category
# 
# class Tag(models.Model):
#     """标签的数据模型"""
#     tag = models.CharField(max_length=256, unique=True)
# 
#     def __str__(self):
#         return self.tag


# Path: blog/forms.py
from django import forms
from django.forms.widgets import CheckboxSelectMultiple
from blog.models import Post, Category, Tag

        labels = {
            'title': '标题',
            'slug': '缩略名',
            'categories': '分类',
            'tags': '标签',
            'body_markdown': '内容',
        }
        help_texts = {
            'title': '您的文章标题',
            'slug': '缩略名(slug)是文章标题的URL友好型版本',
            'tags': '使用标签将更具体的关键字与您的文章关联起来',
            'categories': '使用类别按主题对您的文章进行分组',
            'body_markdown': '使用Markdown语法编辑文章',
        }
        error_messages = {
            'title': {
                'required': '标题不能为空',
            },
            'slug': {
                'required': 'slug不能为空',
                'invalid': 'slug无效',
            },
            'body_markdown': {
                'required': '文章内容不能为空',
            },
        }

class CategoryForm(forms.ModelForm):
    """"分类表单"""
    class Meta:

        model = Category