models.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # -*-coding:utf-8 -*-
  2. from django.db import models
  3. # Create your models here.
  4. class Article(models.Model):
  5. """
  6. 文章内容表
  7. """
  8. ABSTRACT = 0
  9. CHIEF_EDITOR = 1
  10. EDITE_MMEMBER = 2
  11. SUBMISSION_GUIDE = 3
  12. SELECT_GUIDE = 4
  13. YEAR_GUIDE = 5
  14. COMMENT_TYPE = (
  15. (ABSTRACT, u"简介"),
  16. (CHIEF_EDITOR, u"主编致辞"),
  17. (EDITE_MMEMBER,u"编委成员"),
  18. (SUBMISSION_GUIDE,u"投稿指南"),
  19. (SELECT_GUIDE,u"选题指南"),
  20. (YEAR_GUIDE,u"年度指南"),
  21. )
  22. title = models.CharField(u"文章标题", null= True,max_length=128, help_text=u"不超过64个字")
  23. img_url = models.URLField(u"图片url", null=True, default="")
  24. type = models.SmallIntegerField(u"文章分类", default=0, choices=COMMENT_TYPE)
  25. content = models.TextField(u"文章内容",default="", blank=True,null=True)
  26. class Banner(models.Model):
  27. """
  28. 横幅内容表
  29. """
  30. position = models.IntegerField(u"横幅位置",default=1)
  31. img_url = models.URLField(u"图片url", null=True, default="")
  32. display_title = models.CharField(u"展示标题",max_length=128, help_text=u"不超过64个字")
  33. article_url = models.URLField(u"文章url", null=True, default="")
  34. article_title = models.CharField(u"文章标题",max_length=128, help_text=u"不超过64个字")
  35. author = models.CharField(u"文章作者", max_length=32, blank=True,null=True,default="")
  36. content = models.TextField(u"文章内容",default="", blank=True,null=True)
  37. create_time = models.DateField(auto_now_add=True)
  38. class News(models.Model):
  39. """
  40. 横幅内容表
  41. """
  42. title = models.CharField(u"文章标题",max_length=128, help_text=u"不超过64个字")
  43. img_url = models.URLField(u"图片url", null=True, default="")
  44. author = models.CharField(u"文章作者", max_length=32, blank=True,null=True,default="")
  45. content = models.TextField(u"文章内容",default="", blank=True,null=True)
  46. create_time = models.DateField(auto_now_add=True)