0
我有以下模型,它們依賴於django.contrib.auth.models.User
。訪問對象與Django中的模型的一對一關係
from django.db import models
from django.contrib.auth.models import User
class Teacher(models.Model):
user = models.OneToOneField(User, related_name='teacher')
...
class Student(models.Model):
user = models.OneToOneField(User, related_name='student')
...
我怎樣才能得到一個誰涉及到Teacher
User
對象QuerySet
?