Django object creation and Postgres Sequences

前端 未结 2 1503
遇见更好的自我
遇见更好的自我 2021-02-09 14:32

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:19

    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.

提交回复
热议问题