Django Fields Unique_Together Django.How

Author avatar wrote on 08/06/2022


class CompanyCurreny(models.Model):
    company = models.ForeignKey(Company, on_delete=models.CASCADE)
    currency = models.ForeignKey(Currency, on_delete=models.CASCADE)

    class Meta:
        unique_together = ('company', 'currency',)

    def __str__(self):
        return str(self.currency)

CRUDgen Django CRUD generator