from django.db import models from django.contrib.auth.models import User # 用户信息 class Profile(models.Model): # 对应django自带的user user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile') # 贡献度 contribution = models.BigIntegerField() def __str__(self): return 'user {}'.format(self.user.username)