I have existing tables in a postgresql database created with existing  
sequences as the default values for their primary key. I am trying to  
interface with the database with django (i have tried with 1.0.2, 1.1  
and now have django-trunk) and while it seems the model works  
(runserver complains if I have a typo in a column name) I can not  
insert into the table.

If I define the primary key field as follows:

id = models.AutoField(primary_key=True)

an insert (with the save() method) throws:

relation "tablename_id_seq" does not exist

If I define the primary key field like this:

id = models.IntegerField(primary_key=True)

an insert fails with null value in column "id" violates not-null  
constraint

Obviously, I am not specifying a value for the id in my forms as I  
want it to auto increment. How am I supposed to use django with  
existing tables in existing DB's?

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

Reply via email to