class Account(models.Model):
user_name=models.CharField(u"用户名",max_length=80)
password=models.CharField(u"密码",max_length=255)
reg_data=models.DateField()
def __unicode__(self):
return "Account : %s"%self.user_name

class Contact(models.Model):
account=models.OneToOneField(Account,on_delete=models.CASCADE,primary_key=True)
zip_code=models.CharField(max_length=10)
address=models.CharField(max_length=80)
mobile=models.CharField(max_length=20)
def __unicode__(self):
return "%s , %s"%(self.account.user_name,self.mobile)