models.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*-coding:utf-8 -*-
  2. from django.db import models
  3. # Create your models here.
  4. class Users(models.Model):
  5. """
  6. 用户表
  7. """
  8. username = models.CharField(u"用户名", max_length=32, blank=True, default="")
  9. password = models.CharField(u"密码", max_length=128)
  10. real_name = models.CharField(u"真实姓名", max_length=32, blank=True,null=True,default="")
  11. status = models.IntegerField(u"状态",default=0)
  12. permission = models.IntegerField(u"权限",default=3)
  13. signup_time = models.DateField(auto_now_add=True)
  14. def __unicode__(self):
  15. return self.username
  16. class Reader(models.Model):
  17. """
  18. 读者表
  19. """
  20. readername = models.CharField(u"读者昵称", max_length=32, blank=True, default="")
  21. create_time = models.DateField(auto_now_add=True)
  22. question = models.TextField(u"问题内容",max_length=500, default="", blank=True,
  23. help_text=u"不超过250字")
  24. # fb_id = models.IntegerField(u"管理者id",blank=True,null=True)
  25. # fb_content = models.TextField(u"问题回复",max_length=500, null=True,default="", blank=True,
  26. # help_text=u"不超过250字")
  27. class Reply(models.Model):
  28. """
  29. 回复内容表
  30. """
  31. fb_id = models.ForeignKey(Reader, verbose_name=u"关联读者",null = True)
  32. u_id = models.ForeignKey(Users, verbose_name=u"关联用户",null = True)
  33. fb_content = models.TextField(u"问题回复",max_length=500,default="", blank=True,
  34. help_text=u"不超过250字")