This happend to me – it turns out you need to resync your primary key fields in Postgres. The key is the SQL statement:
SELECT setval('tablename_id_seq', (SELECT MAX(id) FROM tablename)+1);
More Related Contents:
- Django bulk_create with ignore rows that cause IntegrityError?
- How to install libpq-fe.h?
- How to reset the sequence for IDs on PostgreSQL tables
- Django: What are the best practices to migrate a project from sqlite to PostgreSQL
- Django: permission denied when trying to access database after restore (migration)
- Migrating existing auth.User data to new Django 1.5 custom user model?
- Django and postgresql schemas
- Docker-compose with django could not translate host name “db” to address: Name or service not known
- Different db for testing in Django?
- Setting DEBUG = False causes 500 Error
- Dynamic File Path in Django
- Django – after login, redirect user to his custom page –> mysite.com/username
- Use variable as dictionary key in Django template
- Create Custom Error Messages with Model Forms
- Django delete FileField
- Confusion in Django admin, static and media files
- What’s the cleanest, simplest-to-get running datepicker in Django?
- Django multi-select widget?
- Where can I find the error logs of nginx, using FastCGI and Django?
- Chaining multiple filter() in Django, is this a bug?
- Django : Unable to import model from another App
- django.db.utils.IntegrityError: UNIQUE constraint failed: rango_category__new.slug
- Django class based view ListView with form
- Docker- django throws error while connecting to postgres: psycopg2.OperationalError: could not connect to server: Connection refused
- How to handle “matching query does not exist” when getting an object
- Token Authentication for RESTful API: should the token be periodically changed?
- Django: Does prefetch_related() follow reverse relationship lookup?
- Can I make list_filter in django admin to only show referenced ForeignKeys?
- Django Migrations Add Field with Default as Function of Model
- Simple Log to File example for django 1.3+