# -*-coding:utf-8 -*-
from django.db import models

# Create your models here.

class Article(models.Model):
    """
    文章内容表
    """
    ABSTRACT = 0
    CHIEF_EDITOR = 1
    EDITE_MMEMBER = 2
    SUBMISSION_GUIDE = 3
    SELECT_GUIDE = 4
    YEAR_GUIDE = 5


    COMMENT_TYPE = (
        (ABSTRACT, u"简介"),
        (CHIEF_EDITOR, u"主编致辞"),
        (EDITE_MMEMBER,u"编委成员"),
        (SUBMISSION_GUIDE,u"投稿指南"),
        (SELECT_GUIDE,u"选题指南"),
        (YEAR_GUIDE,u"年度指南"),
    )

    title = models.CharField(u"文章标题", null= True,max_length=128, help_text=u"不超过64个字")
    img_url = models.URLField(u"图片url", null=True, default="",max_length=500)
    type = models.SmallIntegerField(u"文章分类", default=0, choices=COMMENT_TYPE)
    content = models.TextField(u"文章内容",default="", blank=True,null=True)



class Banner(models.Model):
    """
    横幅内容表
    """
    position = models.IntegerField(u"横幅位置",default=1)
    img_url = models.URLField(u"图片url", null=True, default="",max_length=500)
    display_title = models.CharField(u"展示标题",max_length=128, help_text=u"不超过64个字")
    article_url = models.URLField(u"文章url", null=True, default="")
    article_title = models.CharField(u"文章标题",max_length=128, help_text=u"不超过64个字")
    author = models.CharField(u"文章作者", max_length=32, blank=True,null=True,default="")
    content = models.TextField(u"文章内容",default="", blank=True,null=True)
    create_time = models.DateField(auto_now_add=True)


class News(models.Model):
    """
    横幅内容表
    """
    title = models.CharField(u"文章标题",max_length=128, help_text=u"不超过64个字")
    img_url = models.URLField(u"图片url", null=True, default="",max_length=500)
    author = models.CharField(u"文章作者", max_length=32, blank=True,null=True,default="")
    content = models.TextField(u"文章内容",default="", blank=True,null=True)
    create_time = models.DateField(auto_now_add=True)
