I learned something I didn't know about Django:

Apparently, if you retrieve the same model instance with two different references,
they don't equate with is or ==, you need to compare the id's.  I could be misreading the
symptoms, but this is what I had to do to get it to recognize that the home of the object in
question was its current (going away) location, and act appropriately.
This commit is contained in:
Michael King 2007-08-07 17:08:31 +00:00
parent 13b19b9a16
commit 7f3a8870f0

View file

@ -442,7 +442,7 @@ class Object(models.Model):
text = "player"
# Obviously, we can't send it back to here.
if home is self:
if home.id == self.id:
obj.home = default_home
obj.save()
home = default_home