On Tue, 2008-04-22 at 13:47 -0700, Don Spaulding wrote: [...] > I try to do something like this: > > order = Order() > order.save() > order.items.create(price=Decimal("5.00")) > order.total #gives me 0 > order.save() > order.total #gives me the correct order.total > > My guess is that even though I've saved the item before calling > order.save(), the order objects still doesn't know that the new item > is related to it. Anybody know if this is expected behavior?
Yes, it is expected. As Jorge noted, the "order" instance is a snapshot of the data at one moment in time, not a live update. The Item.create() method doesn't know that whether it's been called as Item.create() or order.items.create() or what the path was. All it knows is that it was called (order.items.create is just another way to get a reference to the function, not a different function call). So the create() method can't really do anything special here, either. Regards, Malcolm -- Borrow from a pessimist - they don't expect it back. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---