I have a model similar to the following:
  class Item(Model):
      name = CharField()
      fieldA = CharField(null=True)
      fieldB = CharField(null=True)

  class ItemHolderA(Model):
      item = ForeignKey('Item')

  class ItemHolderB(Model):
      item = ForeignKey('Item')

Then I attempt the following:
  item = Item.objects.create(name='ItemOne')
  holderA = ItemHolderA.objects.create(item=item)
...
  item = Item.objects.get(name='ItemOne')
  holderB = ItemHolderB.objects.create(item=item)
...
  holderA.item.fieldA = 'Foo'
  holderA.item.save()
  holderB.item.FieldB = 'Bar'
  holderB.item.save()

What I end up with n the db is item.fieldA = None because the item in
holderB is a different object than the one in HolderA.

I've only been using Django for a few months now, so I'm sure I'm
missing something obvious.  I was a bit surprised there was no object
caching, but barring that I couldn't find a way to make sure the
objects were kept in sync.  Any help on this issue would be
appreciated.

-Seighin


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