Example #1
0
class Question(models.Model):
    id = models.AutoField(primary_key=True)
    # question = models.TextField(null=True, blank=True, verbose_name='问题')
    question = RichTextField(verbose_name='问题')
    source = models.CharField(max_length=1000, null=True, blank=True, verbose_name='题目来源')
    difficulty = models.CharField(max_length=40, choices=
                                [('简单', '简单'),
                                 ('中等', '中等'),
                                 ('困难', '困难')], default= 'simple', verbose_name='难度')
    option1 = models.CharField(max_length=1000, null=True, blank=True, verbose_name='选项一')
    option2 = models.CharField(max_length=1000, null=True, blank=True, verbose_name='选项二')
    option3 = models.CharField(max_length=1000, null=True, blank=True, verbose_name='选项三')
    option4 = models.CharField(max_length=1000, null=True, blank=True, verbose_name='选项四')
    right_answer = models.TextField(null=True, blank=True, verbose_name='正确答案')
    functionname = models.TextField(max_length=1000, null=True, blank=True, verbose_name='初始代码')
    example1 = models.CharField(max_length=1000, null=True, blank=True, verbose_name='示例1')
    example2 = models.CharField(max_length=1000, null=True, blank=True, verbose_name='示例2')
    example3 = models.CharField(max_length=1000, null=True, blank=True, verbose_name='示例3')
    example4 = models.CharField(max_length=1000, null=True, blank=True, verbose_name='示例4')
    category = models.ForeignKey('Category', on_delete=None, null=True, verbose_name='题型')
    tags = models.ManyToManyField('Tag', verbose_name='知识点')
    display = models.BooleanField(default=True, verbose_name='是否展示此题')
    author = models.CharField(max_length=1000, verbose_name='作者')

    class Meta:
        verbose_name = "题库管理"
        verbose_name_plural = "题库管理"

    def __str__(self):
        return self.question
Example #2
0
class Blog(models.Model):
    id = models.AutoField(primary_key=True)
    author = models.ForeignKey(User, on_delete=models.DO_NOTHING, verbose_name='作者')
    title = models.CharField('标题', max_length=50)
    content = RichTextField('内容')
    created_time = models.DateTimeField('创建日期')
    tags = models.ManyToManyField(Tag, verbose_name='标签')
    views = models.PositiveIntegerField(default=0)

    class Meta:
        verbose_name_plural = verbose_name = '文章'
        ordering = ['-created_time']

    def count_views(self):
        self.views += 1
        self.save(update_fields=['views'])

    def get_absolute_url(self):
        return "/blog/" + str(self.id)

    def pre_blog(self):
        return Blog.objects.filter(id__lt=self.id).first()

    def next_blog(self):
        return Blog.objects.filter(id__gt=self.id).first()

    def __str__(self):
        return self.title
Example #3
0
class EventRules(models.Model):
    class Meta:
        verbose_name = "赛事规则"
        verbose_name_plural = "赛事规则"

    event = models.OneToOneField(Events, on_delete=models.CASCADE, primary_key=True)
    event_rules = RichTextField(verbose_name='规则', null=True, blank=True, default='无')
Example #4
0
class Snippet(models.Model):
    """Snippet."""

    title = models.CharField('标题', max_length=32)
    intro = models.CharField('简介', max_length=256, default='')
    content = RichTextField()
    tags = models.CharField('标签', max_length=64, null=True, blank=True)

    image = models.ImageField(
        '图片', upload_to=PathAndRename('snippet/'),
        default=consts.DEFAULT_IMAGE
    )

    create_time = models.DateTimeField('创建时间', auto_now_add=True)
    update_time = models.DateTimeField('更新时间', auto_now=True)

    class Meta:
        verbose_name = 'Snippet'
        verbose_name_plural = 'Snippet'

    def __str__(self):
        return self.title

    @property
    def tag_list(self):
        tags = self.tags or ''
        tags = tags.strip('')
        if not tags:
            return []

        return tags.split(',')
Example #5
0
class EventSc(models.Model):
    class Meta:
        verbose_name = "赛事赛程"
        verbose_name_plural = "赛事赛程"

    event = models.OneToOneField(Events, on_delete=models.CASCADE, primary_key=True)
    event_sc = RichTextField(verbose_name='赛程', null=True, blank=True, default='无')
Example #6
0
class Project(models.Model):

    class Meta:
        verbose_name = "项目内容"
        verbose_name_plural = "项目内容"

    content = RichTextField(verbose_name='项目内容')
Example #7
0
class GameDetail(models.Model):
    game_id = models.AutoField(primary_key=True)
    zh_name = models.CharField(max_length=20, blank=True, null=True)
    en_name = models.CharField(max_length=20, blank=True, null=True)
    show_name = models.CharField(max_length=20, default='poketmon')
    slug = models.SlugField(editable=False, default='cat')
    icon = models.ImageField(upload_to='icon/%Y/%m')
    star = models.IntegerField(choices=((1, '1星'), (2, '2星'), (3, '3星'),
                                        (4, '4星'), (5, '5星')),
                               default=3)
    website = models.URLField(blank=True, null=True)
    platform = models.CharField(max_length=15)
    tags = models.ManyToManyField(GameTag)
    contract_address = models.URLField(blank=True, null=True)
    short_description = models.CharField(max_length=33)
    parti_description = RichTextField()
    view_number = models.PositiveIntegerField(default=0)
    like_number = models.PositiveIntegerField(default=0)
    add_time = models.DateField(auto_now_add=True)

    class Meta:
        verbose_name = 'Game Detail'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.zh_name

    def viewNumber(self):
        self.view_number += 1
        self.save(update_fields=['view_number'])

    def save(self, *args, **kwargs):
        self.slug = slugify(self.en_name)
        return super(GameDetail, self).save(*args, **kwargs)
Example #8
0
class SSZModel(models.Model):

    class Meta:
        verbose_name = "SSZ联赛"
        verbose_name_plural = "SSZ联赛"

    content = RichTextField(verbose_name='项目内容')
    
Example #9
0
class EventTraffic(models.Model):
    class Meta:
        verbose_name = "赛事交通"
        verbose_name_plural = "赛事交通"

    event = models.OneToOneField(Events, on_delete=models.CASCADE, primary_key=True)
    event_traffic = RichTextField(verbose_name='赛事交通', null=True, blank=True, default='无')
    lat = models.DecimalField(verbose_name='经纬度', max_digits=9, decimal_places=6, null=True, blank=True, default=116.404)
    lng = models.DecimalField(verbose_name='纬度', max_digits=9, decimal_places=6, null=True, blank=True, default=39.915)
Example #10
0
class Music(models.Model):
    name = models.CharField(max_length=20)
    url = models.CharField(u'音乐路径', max_length=1000)
    author = models.CharField(u'歌手', max_length=20)
    cover = models.CharField(u'封面图片', max_length=1000)
    content = RichTextField(u'歌词')

    def __str__(self):
        return self.name
class Goods(models.Model):
    """
    商品状态
    """
    GOODS_STATUS = (
        (1, "在售"),
        (2, "下架"),
        (3, "删除"),
    )
    """
    商品
    """
    category = models.ForeignKey(Category,
                                 verbose_name="商品类别",
                                 related_name="cates",
                                 on_delete=models.CASCADE,
                                 blank=True,
                                 null=True)
    name = models.CharField(max_length=100, verbose_name="商品名")
    subtitle = models.CharField(default="",
                                verbose_name="商品子标题",
                                max_length=200)
    main_image = models.ImageField(upload_to="goods/images/",
                                   null=True,
                                   blank=True,
                                   verbose_name="商品主图")
    sub_images = models.ImageField(upload_to="goods/images/",
                                   null=True,
                                   blank=True,
                                   verbose_name="商品子图")
    detail = RichTextField(verbose_name="详情内容", null=True, blank=True)
    # detail = UEditorField(verbose_name='商品详情', width=600, height=300, toolbars="full", imagePath="goods/ueditor/",
    #                        filePath="goods/ueditor/", upload_settings={"imageMaxSize": 1204000},
    #                       default='',null=True,blank=True)
    price = models.FloatField(default=0, verbose_name="商品价格")
    stock = models.IntegerField(default=0, verbose_name="商品库存")
    status = models.IntegerField(choices=GOODS_STATUS,
                                 verbose_name="商品状态",
                                 help_text="商品状态")

    is_new = models.BooleanField(default=False, verbose_name="是否新品")
    is_banner = models.BooleanField(default=False, verbose_name="是否轮播")
    is_hot = models.BooleanField(default=False, verbose_name="是否热销")
    create_time = models.DateTimeField(default=datetime.now,
                                       verbose_name="添加时间")
    update_time = models.DateTimeField(default=datetime.now,
                                       verbose_name="更新时间")

    class Meta:
        verbose_name = '商品列表'
        verbose_name_plural = verbose_name
        db_table = "neuedu_product"

    def __str__(self):
        return self.name
Example #12
0
class JoinOur(models.Model):

    class Meta:
        verbose_name = "加盟信息"
        verbose_name_plural = "加盟信息"
        ordering = ['-id']

    def __str__(self):
        return '加盟信息填写, 只会显示最新的'

    info = RichTextField(verbose_name='加盟信息填写')
Example #13
0
class Post(models.Model):
    STATUS_CHOICES = (
        (0, '草稿'),
        (1, '发布'),
    )
    author = models.ForeignKey(settings.AUTH_USER_MODEL)
    title = models.CharField('标题', max_length=100)
    excerpt = models.CharField('摘要', max_length=1000, blank=True)
    # body = models.TextField('正文')
    body = RichTextField('正文')
    created_time = models.DateTimeField('创建时间', default=timezone.now)
    modified_time = models.DateTimeField('最后修改时间', default=timezone.now)
    views = models.PositiveIntegerField('浏览量', default=0)
    comment_enabled = models.BooleanField('允许评论', default=True)
    visible = models.BooleanField('可见', default=True)
    status = models.IntegerField('状态', choices=STATUS_CHOICES, default=0)
    category = models.ForeignKey(Category, blank=True, null=True)
    tags = models.ManyToManyField(Tag, blank=True, null=True)
    json_data = models.CharField(max_length=1000, blank=True)

    class Meta:
        ordering = ('-created_time',)

    def get_comments(self):
        comment_parent_list = self.comment_set.filter(
            parent_comment=None).order_by('created_time')
        comment_child_list = self.comment_set.exclude(
            parent_comment=None).order_by('created_time')
        comment_list = []
        for comment in comment_parent_list:
            comment_list.append([comment, []])
        for comment in comment_child_list:
            for k, v in comment_list:
                if k.pk == comment.parent_comment.pk:
                    v.append(comment)
                    break
                else:
                    if v:
                        for i in v:
                            if i.pk == comment.parent_comment.pk:
                                v.append(comment)
                                break
        comment_list.reverse()
        return comment_list

    def get_absolute_url(self):
        return reverse('blog:detail', kwargs={'pk': self.pk})

    def increase_views(self):
        self.views += 1
        self.save(update_fields=['views'])

    def __str__(self):
        return self.title
Example #14
0
class Article(models.Model):
    STATUS_CHOICES = (
        ('draft', '草稿'),
        ('published', '发布'),
    )

    articleauthor = UserProfile.objects.all()

    ARTICLE_AUTHOR_CHOICES = [(str(user), str(user)) for user in articleauthor]

    title = models.CharField(max_length=70, default="title", verbose_name="标题")
    content = RichTextField(verbose_name="内容")
    #taggit
    tags = TaggableManager()
    slug = models.SlugField(max_length=250, unique_for_date='publish')
    publish = models.DateTimeField(default=timezone.now)
    created_time = models.DateField(auto_now_add=True)
    modified_time = models.DateTimeField(auto_now=True)
    excerpt = models.CharField(max_length=200, blank=True)
    #tags = models.ForeignKey(Tag,
    #                         blank=True,
    #                         null=True),
    category = models.ForeignKey(Category,
                                 blank=True,
                                 null=True,
                                 verbose_name='目录')
    author = models.CharField(choices=ARTICLE_AUTHOR_CHOICES,
                              default='',
                              max_length=30)
    #author = models.ForeignKey('about.UserProfile',)
    status = models.CharField(max_length=10,
                              choices=STATUS_CHOICES,
                              default='draft',
                              verbose_name='状态')

    #    published = ArticleManager()

    def save(self, *args, **kwargs):
        self.excerpt = self.content[:54]
        super(Article, self).save(*args, **kwargs)

    def get_absolute_url(self):
        return reverse('blog:article_page', kwargs={'article_id': self.id})

    def get_edit_url(self):
        return reverse('about:article_edit', kwargs={'article_id': self.id})

    class Meta:
        ordering = ('created_time', )
        verbose_name = u"文章"
        verbose_name_plural = verbose_name

    def __unicode__(self):
        return self.title
Example #15
0
class GoodsDetail(models.Model):
    class Meta:
        verbose_name = "GoodsDetail"
        verbose_name_plural = "GoodsDetails"

    def __str__(self):
        return str(self.goods)

    goods = models.OneToOneField(Goods,
                                 on_delete=models.CASCADE,
                                 primary_key=True)
    detail = RichTextField(verbose_name='介绍', default='无')
Example #16
0
class Article(models.Model):
    image = models.CharField('图片Url',
                             max_length=50,
                             default='health/images/jigou-img-01.png')
    title = models.CharField('标题', max_length=200)
    keywords = models.CharField('关键词', max_length=200, default='关键词:')
    desc = models.CharField('摘要', max_length=120)
    content = RichTextField('内容')
    pub_date = models.DateField('发布日期')

    def __str__(self):
        return self.title
Example #17
0
class Comment(models.Model):
    text = RichTextField('评论')
    created_time = models.DateTimeField(default=timezone.now)
    post = models.ForeignKey(Post)
    user = models.ForeignKey(settings.AUTH_USER_MODEL)
    parent_comment = models.ForeignKey('self',
                                       verbose_name='上级评论',
                                       blank=True,
                                       null=True)
    enable = models.BooleanField(default=True)

    def __str__(self):
        return self.text[:20]
Example #18
0
class Industry(models.Model):
    image = models.CharField('图片Url',
                             max_length=50,
                             default='health/images/jigou-img-03.png')
    title = models.CharField('标题', max_length=200)
    keywords = models.CharField('关键词', max_length=200)
    desc = models.TextField('摘要', max_length=120, default='')
    content = RichTextField('内容')
    pub_date = models.DateField('发布日期')
    ordering = ['-pub_date']

    def __str__(self):
        return self.title
Example #19
0
class Post(models.Model):
    title = models.CharField(max_length=80, verbose_name='文章标题')
    body = RichTextField(verbose_name='文章正文')  #富文本编辑器
    #创建时间
    created_time = models.DateTimeField(verbose_name='创建时间')
    #最后一次修改时间
    modified_time = models.DateTimeField(verbose_name='修改时间')
    #文章摘要
    excerpt = models.CharField(max_length=100, blank=True, verbose_name='文章摘要')

    #分类,一对多关系,一篇文章有一个分类,一个分类有多篇文章
    category = models.ForeignKey(Category, verbose_name='分类')
    #标签,多对多关系,一篇文章可以有多个标签
    tags = models.ManyToManyField(Tag, blank=True, verbose_name='标签')
    #作者
    author = models.ForeignKey(User, verbose_name='作者')
    #阅读量字段
    views = models.PositiveIntegerField(default=0)

    @python_2_unicode_compatible
    def __str__(self):
        return self.title

    #这个方法生成url
    def get_absolute_url(self):
        return reverse('blog:detail', kwargs={'pk': self.pk})

    #阅读量
    def increase_views(self):
        self.views += 1
        #update_fields 参数来告诉 Django 只更新数据库中 views 字段的值
        self.save(update_fields=['views'])

    #自动生成文章摘要
    # def save(self,*args,**kwargs):
    # 	#如果没有填定摘要
    # 	if not self.excerpt:
    # 		#首先实例化一个 Markdown 类,用于渲染 body 的文本
    # 		md = markdown.Markdown(extensions=[
    # 			'markdown.extensions.extra',
    # 			'markdown.extensions.codehilite',
    # 		])
    # 		# 先将 Markdown 文本渲染成 HTML 文本
    # 		# strip_tags 去掉 HTML 文本的全部 HTML 标签
    # 		# 从文本摘取前 54 个字符赋给 excerpt
    # 		self.excerpt = strip_tags(md.convert(self.body))[:54]
    # 	# 调用父类的 save 方法将数据保存到数据库中
    # 	super(Post, self).save( *args, **kwargs )

    class Meta:
        ordering = ['-created_time']
Example #20
0
class Article(models.Model):

    CATEGORY_CHOICES = [('政策', '政策'), ('文化', '文化'), ('资讯', '资讯')]
    headimg = models.CharField('头像', max_length=200, blank=True, null=True)
    title = models.CharField(max_length=100)  # 文章题目
    category = models.CharField('类型',
                                max_length=10,
                                choices=CATEGORY_CHOICES,
                                default='政策')
    introduction = models.TextField(blank=True, null=True)  # 文章摘要
    content = RichTextField()  # 文章正文

    def __str__(self):
        return self.title
Example #21
0
class Articles(models.Model):
    titlePage = models.ImageField(upload_to='live/',blank=True,null=True)
    title = models.TextField( blank=True, null=True)
    keyword = models.CharField(max_length=100, blank=True, null=True)
    content = RichTextField()
    name = models.CharField(max_length=50, blank=True, null=True)
    like = models.IntegerField(blank=True, null=True)
    created_at = models.DateTimeField()
    updated_at = models.DateTimeField()

    # 展示HTML文本
    def get_desc(self):
        html = self.content
        dr = re.compile(r'<[^>]+>', re.S)
        dd = dr.sub('', html)
        if(len(dd) > 300):
            return dd[0:300] + "..."
        return dd + "..."

    def get_eng_month(self):
        month = ['January','February','March','April','May','June','July','Aguest','September','October','November','December']
        return month[int(self.created_at.month()) - 1]

    def get_likes(self):
        if(self.like == None):
            return "0"
        return str(self.like)

    # 自己转成dict对象,方便转成json
    def to_dict(self):
        data = {}
        for f in self._meta.concrete_fields:
            data[f.name] = f.value_from_object(self)
        return data

    def __str__(self):
        return self.title.encode('utf-8')

    def delete(self, *args, **kwargs):
        # You have to prepare what you need before delete the model
        storage, path = self.titlePage.storage, self.titlePage.path
        # Delete the model before the file
        super(Articles, self).delete(*args, **kwargs)
        # Delete the file after the model
        storage.delete(path)

    class Meta:
        # managed = False
        db_table = 'articles'
Example #22
0
class Comment(models.Model):
    question = models.ForeignKey(Question,
                                 related_name='comments',
                                 on_delete=models.CASCADE)

    answer = RichTextField(verbose_name="回答")
    #image = models.ImageField(upload_to='comment/%Y/%m/%d', blank=True)
    created = models.DateTimeField(auto_now_add=True)
    publish = models.DateTimeField(auto_now=True)

    class Meta:
        ordering = ('-publish', )

    def __str__(self):
        return self.answer
Example #23
0
class Comment(BaseComment):
    '''
    '''
    content = RichTextField(verbose_name='评论正文')
    post = models.ForeignKey(Post,
                             on_delete=models.CASCADE,
                             related_name='comments',
                             verbose_name='文章')  #related_name反向查询

    def __str__(self):
        return 'comment'

    class Meta:
        verbose_name = verbose_name_plural = '评论'
        ordering = ['-created_time']
Example #24
0
class Post(models.Model):
    title = models.CharField(max_length=70)
    created_time = models.DateTimeField()
    modified_time = models.DateTimeField()
    excerpt = models.CharField(max_length=200, blank=True)
    category = models.ForeignKey(Category)
    tags = models.ManyToManyField(Tag, blank=True)
    author = models.ForeignKey(User)
    content = RichTextField(default='')

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('blog:detail', kwargs={'pk': self.pk})
Example #25
0
class Question(models.Model):
    title = models.CharField(max_length=300, verbose_name='标题')
    #body = models.TextField(blank=True)
    body = RichTextField(verbose_name='详细描述', blank=True)
    #author
    created = models.DateTimeField(auto_now_add=True)
    publish = models.DateTimeField(default=timezone.now())

    class Meta:
        ordering = ('-publish', )

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('question:question_detail', args=[self.id])
Example #26
0
class Aricle(models.Model):
    title = models.CharField(max_length=100, verbose_name='标题')
    desc = models.CharField(max_length=100, blank=True, verbose_name='摘要')
    category = models.ForeignKey('Category',
                                 verbose_name='分类',
                                 on_delete=models.DO_NOTHING)
    tags = models.ManyToManyField('Tag',
                                  related_name='posts',
                                  verbose_name='标签')
    content = RichTextField(verbose_name='内容')
    is_markdown = models.BooleanField(verbose_name='使用markdown', default=True)
    html = models.TextField(verbose_name='渲染后的格式', default='')
    img = models.ImageField(upload_to='article/img',
                            blank=True,
                            null=True,
                            verbose_name='封面图')
    owner = models.ForeignKey(User,
                              verbose_name='作者',
                              on_delete=models.DO_NOTHING)
    pv = models.PositiveIntegerField(default=0, verbose_name='pv')
    add_time = models.DateTimeField(auto_now_add=True, verbose_name='添加时间')
    like_record = GenericRelation(LikeRecord)
    Like_count = GenericRelation(LikeCount)

    def __str__(self):
        return self.title

    def increse_pv(self):
        return type(self).objects.filter(id=self.id).update(pv=F('pv') + 1)

    def save(self, *args, **kwargs):
        config = {
            'codehilite': {
                'use_pygments': False,
                'css_class': 'prettyprint linenums code-padding',
            }
        }
        self.html = markdown.markdown(
            self.content,
            extensions=["codehilite", "fenced_code", "nl2br"],
            extension_configs=config)
        return super(Aricle, self).save(*args, **kwargs)

    class Meta:
        verbose_name_plural = verbose_name = '文章'
        ordering = ['-id']
Example #27
0
class Article(models.Model):
    caption = models.CharField(max_length=50, default='')
    author = models.ForeignKey(User, on_delete=models.CASCADE)
    tags = models.ManyToManyField(Tag, blank=True)
    content = RichTextField()

    read_num = models.IntegerField(default=0)
    publish_time = models.DateTimeField(auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)
    recommend = models.BooleanField(default=False)

    view_num = GenericRelation(ViewNum)

    def __str__(self):
        return u'%s %s %s' % (self.caption, self.author, self.publish_time)

    class Meta:
        ordering = ['-publish_time']
Example #28
0
class Comment(MPTTModel):
    name = models.CharField(max_length=100)

    text = RichTextField()

    # 上一个人名称
    previous = models.CharField(blank=True, null=True, max_length=100)

    # 头像地址
    avatar_url = models.CharField(max_length=4000, blank=True, default="")

    # parent为该评论的父评论,所以第一个参数为'self',当为空时表示为第一层级的评论
    # 指定related_name='children',这样可以父评论通过comment.children获取子评论,默认是通过comment.comment_set获取
    # parent = models.ForeignKey('self', blank=True, null=True, related_name='children', on_delete=models.SET_NULL)

    parent = mpttModels.TreeForeignKey('self',
                                       null=True,
                                       blank=True,
                                       related_name='children',
                                       db_index=True,
                                       on_delete=models.SET_NULL)

    created_time = models.DateTimeField(auto_now_add=True)
    # parent =
    post = models.ForeignKey('blog.Article', on_delete=models.CASCADE)

    # 访问者ip地址
    ip = models.CharField(max_length=100, blank=True)

    # 访问者所在城市
    city = models.CharField(max_length=100, blank=True)

    email = models.EmailField(max_length=255, blank=True)
    url = models.URLField(blank=True)

    visible = models.BooleanField(default=True)

    def __str__(self):
        return self.text[:20]

    class MPTTMeta:
        order_insertion_by = ['-created_time']
Example #29
0
class AiArticle(models.Model):
    id = models.IntegerField(primary_key=True)
    title = models.CharField(max_length=255)
    brief = models.CharField(max_length=50)
    #content = models.TextField()
    content = RichTextField()
    page = models.IntegerField(default=1)
    pub_date = models.DateTimeField(blank=True, null=True,default=timezone.now)
    last_modify = models.DateTimeField(auto_now=True)
    is_raw = models.IntegerField(default=1)
    refer_url = models.CharField(max_length=255,default=0)
    #refer_site = models.CharField(max_length=255,default=0)
    author_name = models.CharField(max_length=50,default='wang')
    author_username = models.CharField(max_length=50,default='admin')
    ai_subcate_id = models.IntegerField(default=1001)

    class Meta:
        managed = False
        db_table = 'ai_article'
    def __unicode__(self):
        return self.title
Example #30
0
class CommentReply(BaseComment):
    '''
    '''
    reply_content = RichTextField(verbose_name='正文')
    reply_comment = models.ForeignKey(Comment,
                                      on_delete=models.CASCADE,
                                      related_name='replies',
                                      blank=True,
                                      verbose_name='评论回复')
    reply = models.ForeignKey('self',
                              null=True,
                              blank=True,
                              on_delete=models.CASCADE,
                              verbose_name='回复对象')

    def __str__(self):
        return 'reply'

    class Meta:
        verbose_name = verbose_name_plural = '评论回复'
        ordering = ['-created_time']