0
我創造了這個模型在我的項目分配relationsships建在用戶
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.db import models
from quiz.models import Quiz
# Create your models here.
class Organisation(models.Model):
name = models.CharField(max_length=255)
user = models.ForeignKey(User, on_delete=models.CASCADE)
quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE)
group = models.ForeignKey(Group, on_delete=models.CASCADE)
但是,我的理解應該是周圍的其他方法。我希望用戶屬於一個組織。
我該如何做到這一點?不僅在我創建的應用程序中,而且在項目中普遍使用。
謝謝!
Downvoter,謹慎地闡述爲什麼downvote? – Ms01
可能是因爲解決方案是有文檔記錄的,而且容易找到(「django extend User」應該會產生一些有用的結果),這屬於「這個問題並不顯示任何研究工作」。 (nb:我不是downvoter)。 –