primary key problem
Greetings,
I created the models in a Django app using manage.py inspectdb on an
existing postgres database. This seemed to work except that all the
primary keys were described in the models as IntegerFields, which made
them editable in the admin panel, and had to be hand-entered based on
knowledge of the id of the previous record. I just learned about this
after some usage by the client, so I went back to change things like
artist_id = models.IntegerField(primary_key=True)
...to...
artist_id = models.AutoField(primary_key=True)
Now the id fields don't appear in the admin panel, but adding new rows
has become impossible.
> IntegrityError at /admin/franklins_app/blog/add/
> duplicate key value violates unique constraint "blog_pkey"
I've checked the tables and there don't seem to be insane entries in
primary key columns. I've tried commenting the aforementioned lines
out of the models completely and I get the same error. Does anyone
know the fix here? Thanks for the help.
Franklin
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home