ValueError: Field 'id' expected a number but got 'Processing'

前端 未结 8 1636
南方客
南方客 2021-01-27 23:55

I\'m going to deploy my django application on DigitalOcean. Everything gone well, except following error, and my question is: where can I find source of this error, actually in

8条回答
  •  情歌与酒
    2021-01-28 00:21

    Just to share the solution that worked with my similar error that been received: In my case, this same error was received because I was creating the model instant with the fields values directly, without specifying the field name, so always the ID was taking the first one as default (ID=field1). The problem solved by adding the attributes name as well to the Instant creation.

    Was:

    model_instant = YourModel(field1, field2,...etc)
    

    Solved by:

    model_instant = YourModel(field1 = field1, field2 = field2,...etc)
    

    Do this then follow what been recommended above of 1) deleting the dB file, and 2) delete the migrations then 3) do the makemigrations your_app_name then 4) migrations, then 5) run the server and you should be good to go.

提交回复
热议问题