开发者

What's the difference between OneToOne and Subclassing a model in Django

For example:

class Subdomain(Site):
    #fields 开发者_如何转开发here

and

class Subdomain(models.Model):
    site = models.OneToOne(Site)
    #fields here


Models with a OneToOne have an independent PK; submodels always use the PK of their supermodel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜