0
客戶用戶模型非常好,但如果要構建包含多個應用程序的項目,則每個應用程序都可以假定它將用戶模型作爲其模型的一部分。我的計劃是恢復到標準的django用戶,並在每個應用程序中有一個配置文件。具有多個應用程序中的自定義數據的Django用戶
例如。
app1.models.py
from django.contrib.auth.models import User
Class App1User(models.Model):
user = models.OneToOne(User)
special = models.CharField(some field that relates to the user in this app)
app2.models.py
from django.contrib.auth.models import User
Class App2User(models.Model):
user = models.OneToOne(User)
another = models.CharField(some field that relates to the user in this app)
等
然後添加代碼去並在需要時獲得相關的配置文件數據,也許增加一些中間件或模板上下文處理器。在我走下這條路線之前,我想檢查一下這是最Djangoeque的解決方案嗎?