I have the models, Product and Attribute, with a many to many relation between them (in Product: attributes = ManyToManyField(Attribute)) A third model, AttributeValue has a ForeignKey(Attribute), as each attribute can have many values.
I have created another models, StockUnit, with a ForeignKey(Product), a ManyToMany(AttributeValue); for every combination of AttributeValues belonging to Attributes that relate to a Product p, there will be one StockUnit with those AttributeValues. To ensure this is the case, I had overridden Product.save(), and after calling super(Product,self).save(), I then got the list of attributes, and did all the work to maintain StockUnits. However, I found that the changes to StockUnits would only appear after I saved the product a second time. I have concluded that this is because the Product<->Attribute relationship only gets saved into the product_attributes table AFTER Product.save() gets called. The end result being that I cannot maintain the StockUnits in Product.save(). Where is the best place to put the code that maintains StockUnits? Logically, it belongs most closely in the ProductAttributes.save() method, but since this model is implicit in the ManyToManyField, I can't put it there! Any suggestions? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---

