假设我有一个父类(ThingsThatMigrate)和两个孩子(Coconut和Swallow).现在让我们说我有一个ThingsThatMigrate对象.我怎样才能确定它实际上是椰子还是燕子?一旦这样做了,我怎样才能到达椰子或燕子对象?
我想在我的系统中实现用户.我知道Django已经有了一个身份验证系统,我一直在阅读文档.但我不知道它们之间的区别
from django.contrib.auth.models import User
class Profile(User):
# others fields
Run Code Online (Sandbox Code Playgroud)
和
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.OneToOneField(User)
# others fields
Run Code Online (Sandbox Code Playgroud)
我不想知道为什么要使用这一个或另一个,但是在引擎盖下会发生什么.有什么不同?