Django object creation and Postgres Sequences

前端 未结 2 1193
一生所求
一生所求 2021-02-09 14:57

I have an import script which runs a series of commands to get things from one Postgres DB to another, both running the same Django codebase. For the most part, it uses ./manage

2条回答
  •  星月不相逢
    2021-02-09 15:22

    The autoincrement fields works, but yo must make the query like

    MyObject.objects.create(title='foo')
    

    without the id field, this is autocalculated with the database.

提交回复
热议问题