Hi, I am using Django version 1.0.2 final with Python 2.5.2 I have a model called Scheduler in which I have a colomn (called "parent_id") which define a recursive relationship. I defined it like this :
class Scheduler(models.Model): id_schedule = models.AutoField(primary_key=True) id_parent = models.ForeignKey("self",db_column='id_schedule') id_object_type = models.ForeignKey(ObjectTypes, db_column='id_object_type') .... I create a new object with : action=Scheduler(id_schedule = None,id_parent_id=1,id_object_type_id = 2 ...... My problem is that when I want to save the object (with action.save ()), it fails with the following error : <class 'psycopg.IntegrityError'>ERROR: null value in column "id_parent" violates not-null constraint INSERT INTO "scheduler" ("id_schedule", "id_object_type", .... So the generated SQL query does not include the id_parent field ! Why ? What am i doing wrong ? Thanks for your help F. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---