File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 117
117
118
118
STATIC_URL = '/static/'
119
119
STATICFILES = os .path .join (BASE_DIR , 'blog/static' )
120
+
121
+ AUTH_USER_MODEL = 'usera.ForumUser'
Original file line number Diff line number Diff line change 1
1
from django .db import models
2
+ from django .contrib .auth .models import AbstractUser
3
+
2
4
3
5
# Create your models here.
6
+ class ForumUser (AbstractUser ):
7
+ GENDER_CHOICES = (
8
+ ('M' , 'male' ),
9
+ ('F' , 'female' ),
10
+ )
11
+ mugshot = models .ImageField ('头像' , upload_to = '/uploads' )
12
+ gender = models .CharField ('性别' , max_length = 1 , choices = GENDER_CHOICES )
13
+ birthday = models .DateField ('生日' )
14
+ self_intro = models .TextField ('个人简介' )
15
+ sign_up_ip = models .GenericIPAddressField ('注册时IP' )
16
+ last_login_time = models .DateTimeField ('最后一次登录时间' , auto_now = True )
17
+ last_login_ip = models .GenericIPAddressField ('最后一次登录IP' )
18
+ website = models .URLField ('个人网站' , max_length = 200 )
19
+ github = models .URLField ('GitHub主页地址' , max_length = 200 )
20
+ nickname = models .CharField ('昵称' , max_length = 20 )
21
+ sector = models .CharField ('所在单位' , max_length = 200 )
22
+ position = models .CharField ('职位' , max_length = 40 )
23
+ focus_users = models .ManyToManyField ('self' , verbose_name = '关注的人' , related_name = 'focus_users' )
24
+ fans = models .ManyToManyField ('self' , verbose_name = '粉丝' , related_name = 'fans' )
25
+
26
+ def __str__ (self ):
27
+ return self .user_name
You can’t perform that action at this time.
0 commit comments