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

# Create your models here.
class Users(models.Model):
    """
    用户表
    """
    username = models.CharField(u"用户名", max_length=32, blank=True, default="")
    password = models.CharField(u"密码", max_length=128)
    real_name = models.CharField(u"真实姓名", max_length=32, blank=True,null=True,default="")
    status = models.IntegerField(u"状态",default=0)
    permission = models.IntegerField(u"权限",default=3)
    signup_time = models.DateField(auto_now_add=True)


    def __unicode__(self):
        return self.username



class Reader(models.Model):
    """
    读者表
    """
    readername = models.CharField(u"读者昵称", max_length=32, blank=True, default="")
    create_time = models.DateField(auto_now_add=True)
    question = models.TextField(u"问题内容",max_length=500, default="", blank=True,
                             help_text=u"不超过250字")
    # fb_id = models.IntegerField(u"管理者id",blank=True,null=True)
    # fb_content = models.TextField(u"问题回复",max_length=500, null=True,default="", blank=True,
    #                          help_text=u"不超过250字")


class Reply(models.Model):
    """
    回复内容表
    """
    fb_id = models.ForeignKey(Reader, verbose_name=u"关联读者",null = True)
    u_id = models.ForeignKey(Users, verbose_name=u"关联用户",null = True)
    fb_content = models.TextField(u"问题回复",max_length=500,default="", blank=True,
                             help_text=u"不超过250字")