#models.py class Item(models.Model): parte = models.ForeignKey('Parte') cantidad = models.PositiveIntegerField()
class Parte(models.Model): num_parte = models.CharField(max_length=14, primary_key=True) descripcion = models.CharField(max_length=40, blank=True) class Item_Carrito(models.Model): item = models.ForeignKey('Item') carrito = models.ForeignKey('Carrito') class Meta: unique_together = ('carrito', 'item') class Carrito(models.Model): cliente = models.ForeignKey('Cliente', unique=True) I have the restriction that the same part (Parte) cannot be related more than once with a "Carrito" instance. I think that could easily be solved using: class Meta: unique_together=('carrito', 'item.parte') In the Item_Carrito Model. However, I can't use 'item.parte' as django gives me an error that I'm referring to a field that doesnt' exist. Is there a way I can use a field of another object in unique_together? Thank you, -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.