20👍
Quoting from the django doc:
If the model’s primary key is an AutoField it does not retrieve and
set the primary key attribute, as save() does.
According to django, it creates a list of database records in one shot, but the objects’ ids are not retrieved. I think it’s good for the situation where you do large insertions without further processing the data.
10👍
As of Django 1.10 docs:
If the model’s primary key is an
AutoField
it does not retrieve and set the primary key attribute, assave()
does, unless the database backend supports it (currently PostgreSQL).
So if you are using Django 1.10+, and you are not getting primary keys returned, it’s because only PostgreSQL supports it.
- [Django]-How to serve media files on Django production environment?
- [Django]-What are the benefits of pip and virtualenv?
- [Django]-Django: Not Found static/admin/css
Source:stackexchange.com