标签:foo model nes ima ipad span ipa key apt
class Business(models.Model): caption = models.CharField(max_length=32) code = models.CharField(max_length=32, null=True) # fk = models.ForeignKey(to=‘Foo‘, on_delete=models.CASCADE) class Host(models.Model): nid = models.AutoField(primary_key=True) hostname = models.CharField(max_length=32, db_index=True) ip = models.GenericIPAddressField(db_index=True) port = models.IntegerField() b = models.ForeignKey(to=‘Business‘, on_delete=models.CASCADE, to_field=‘id‘)
由Host绑定Business
通过
b = models.ForeignKey(to=‘Business‘, on_delete=models.CASCADE, to_field=‘id‘)实现两个数据库的绑定
标签:foo model nes ima ipad span ipa key apt
原文地址:https://www.cnblogs.com/my-love-is-python/p/9359761.html