在 我有以下不推荐使用的代码:
class samberos(User):
objects = UserManager()
backstage = models.BooleanField(default=False, help_text="Si el sambero esta activo, pero no tocando instrumentos ... ")
dni = models.CharField(max_length=10, blank=True, null=True)
phone = models.CharField(max_length=9, blank=True, null=True)
movil = models.CharField(max_length=9, blank=True, null=True, help_text="Este es el numero para los SMS")
instrumento = models.ForeignKey(instrumentos)
def url(self):
return u'<a href="/samberos/' + self.username + u'/" title="' + self.username + u'" rel="gb_page_center[400, 210]">' + self.username + u'</a>'
class Meta:
ordering = ['username']
verbose_name_plural = "samberos"
verbose_name = "samberos"
我想把它更新到一个新版本的django,目前还不支持,不想失去用户。我该怎么做?在
现在我运行的是1.8版,当我运行服务器时,出现了以下错误:
^{pr2}$用于创建此代码的django版本是1.2,与1.4配合使用很好
在本例中,我强烈建议将这些字段迁移到
UserProfile
模型中。在这是因为django建议将
OneToOneField
与User
模型一起使用,而不是继承它(这不仅解决了这个问题,而且将使您符合标准,避免将来的未知问题)。在如documentation about additional fields for users所述:
当然,您需要一个data migration来将旧信息迁移到这个新模型中,但是我可以向您保证,与当前标准保持同步是值得的。在
相关问题 更多 >
编程相关推荐