Hi,

So I currently have two models

model Foo(models.Model):

model Bar(models.Model):
    foo = models.ForeignKey(Foo)
    address = models.IPAddress()

    class Meta:
        unique_together(('address', 'foo'),)

and this works fine to ensure that the address is unique across each
instance of foo.

Now I want to introduce an intermediary between the two classes, but I
want to keep the constraint.

So it becomes:

model Foo(models.Model):

model Intermediary(models.Model):
    foo = models.ForeignKey(Foo)

model Bar(models.Model):
    intermediary = models.ForeignKey(Intermediary)
    address = models.IPAddress()

Now, is it still possible to specify that the addresses in Bar should
be unique across each instance of Foo? I could add another foreign key
directly from Bar to Foo but that seems ugly.

Thanks,
Mike

-- 
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.

Reply via email to