Ran into a bit of a problem, i\'m getting the above error message when i run \'python manage.py syncdb\' I\'m working on a fairly old site. It\' running django
This usually means that your primary key sequence has gone out of sync. This may have been caused by a bad migration etc..
To fix this;
1. Start the dbshell
python manage.py dbshell
2. Find the current highest value of the primary key
select max(id) from django_content_type;
3. Change the primary key sequence to now start at a value higher than the value found in step 2.
So assuming the value returned in step 2 was 290780 then alter sequence to start at a number greater than 290780
alter sequence django_content_type_id_seq restart with 295000;