Re: Django newbie question: saving composite objects.

2007-03-01 Thread Manoj Govindan
Hi Malcolm, > I would like to see if subProject.parent the first time you test it > (your first assert()) is exactly the same as after the subProject.save() > line. > I did a bit of debugging and uncovered the following facts. I think they explain the goings on pretty clearly. Let us take the s

Re: Django newbie question: saving composite objects.

2007-02-26 Thread Malcolm Tredinnick
On Mon, 2007-02-26 at 17:19 +, Manoj Govindan wrote: > Hi Malcolm, > After reading your post, I added a couple of assertions. > 1) Check for subProject.parent immediately after creating the > subProject object. > 2) Compare id()s of project and subProject.parent *after saving* > subProject. >

Re: Django newbie question: saving composite objects.

2007-02-26 Thread Manoj Govindan
Hi Malcolm, After reading your post, I added a couple of assertions. 1) Check for subProject.parent immediately after creating the subProject object. 2) Compare id()s of project and subProject.parent *after saving* subProject. The test now looks like this: class ProjectTests(unittest.TestCase):

Re: Django newbie question: saving composite objects.

2007-02-24 Thread Malcolm Tredinnick
On Sat, 2007-02-24 at 18:41 +, Manoj Govindan wrote: > Hi, > Consider a model and a simple test for the model. > > class Project(models.Model): > name = models.CharField(maxlength = 255) > parent = models.ForeignKey('self', null = True) > > class ProjectTests(unittest.TestCase): >

Django newbie question: saving composite objects.

2007-02-24 Thread Manoj Govindan
Hi, Consider a model and a simple test for the model. class Project(models.Model): name = models.CharField(maxlength = 255) parent = models.ForeignKey('self', null = True) class ProjectTests(unittest.TestCase): def testCreateProjectAndSubProject(self): project = Project(name