Django アプリに 3 つのモデルがあり、それぞれに「ホスト名」フィールドがあります。いくつかの理由から、これらは異なるモデルで追跡されます。
class device(models.Model):
...
hostname = models.CharField(max_length=45, unique=True, help_text="The hostname for this device")
...
class netdevice(models.Model):
...
hostname = models.CharField(max_length=45, unique=True, help_text="Name Associated with Device", verbose_name="Hostname")
...
class vipdevice(models.Model):
...
hostname = models.CharField(max_length=45, unique=True, help_text="Name associated with this Virtual IP", verbose_name="name")
...
ホスト名フィールドが 3 つのモデル間で重複していないことを確認するための検証を設定するにはどうすればよいですか?
http://docs.djangoproject.com/en/dev/ref/validators/#ref-validatorsを見てきましたが、それが正しいパスかどうかはわかりません。特に、関数内の他のクラスからオブジェクトを作成する場合など.