I am making a build database where each product which can be built has
come components which are required to build it.  These components in
turn have versions which are required for a particular build.  The
relevant parts of the models are reproduced below.

class Component(models.Model):
    name=models.CharField(maxlength=60)

class ComponentVersion(models.Model):
    component=models.ForeignKey(Component)
    version=models.PositiveIntegerField()

class Product(models.Model):
    required_components=models.ManyToManyField(Component)

class Build(models.Model):
    product=models.ForeignKey(Product)
    components=models.ManyToManyField(ComponentVersion)

I have found 2 problems with this:
1. Is there any way of enforcing the ManyToManyField on Build to only
allow ComponentVersions which have a Component in the ManyToManyField
on the associated Product?

2. How would I construct a newform to handle creating/editing Builds
where drop downs for Each component are generated dynamically?  I have
looked at http://tinyurl.com/yw583d and it comes come way towards a
solution but I can't figure out how to make the queryset which you
iterate over definable at runtime.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to