Blame view

homepage/models.py 1.45 KB
c51fd49af   zhuzhenchao   first add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  # coding: utf-8
  
  from django.db import models
  
  from django.contrib.auth.models import AbstractUser
  
  
  # 数据库表结构
  class ForumUser(AbstractUser):
      '''
      django.contrib.auth.models.User 默认User类字段太少,用AbstractUser
      自定义一个User类,增加字段
      '''
      nickname = models.CharField(max_length=200, null=True, blank=True)
      avatar = models.CharField(max_length=200, null=True, blank=True)    # 头像
      signature = models.CharField(max_length=500, null=True, blank=True) # 签名
      location = models.CharField(max_length=200, null=True, blank=True)
      website = models.URLField(null=True, blank=True)
      company = models.CharField(max_length=200, null=True, blank=True)
      role = models.IntegerField(null=True, blank=True)                   # 角色
      balance = models.IntegerField(null=True, blank=True)                # 余额
      reputation = models.IntegerField(null=True, blank=True)             # 声誉
      self_intro = models.CharField(max_length=500, null=True, blank=True)# 自我介绍
      updated = models.DateTimeField(null=True, blank=True)
      twitter = models.CharField(max_length=200, null=True, blank=True)
      github = models.CharField(max_length=200, null=True, blank=True)
      douban = models.CharField(max_length=200, null=True, blank=True)
  
      def __unicode__(self):
          return self.username
  
      class Meta(object):
          db_table = 'forum_forumuser'
          verbose_name = verbose_name_plural = u'用户'