我正在扩展django的用户模型。db_index和unique在OneToOne关系上为True
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User, _(u"User"))
那么,是否有可能使用db_index = True和unique = True与用户字段?然后我需要通过用户名实现搜索。我想过狮身人面像。对此有何想法?也许有一些好的教程链接? TIA
你不必把唯一的因为它的OnetoOneField – catherine