0
SAAS의 계정은 Account(models.Model)
입니다. 다음은 좋은 생각일까요?Django 다중 테넌트 아키텍처 - 모든 모델에 tennant_id에 대한 참조가 있어야합니다.
class MyModel(models.Model):
account = models.ForeignKey(Account)
spam = models.CharField(max_length=255)
class MyOtherModel(models.Model):
# The next attribute `account` is the line in question.
# Should it be included even though mymodel.account can get the same value?
# The architecture could change later, and I might regret not including it,
# but I can't think of many reasons why, other than filtering a list out of
# this model like MyOtherModel.objects.filter(account=some_account).all()
# Are there other considerations?
account = models.ForeignKey(Account)
mymodel = models.ForeignKey(MyModel)
eggs = models.CharField(max_length=255)