开发者

Creation of a django model instance not working on a custom management command

I'm trying to create a new instance of one of my Django models. When I do it in my python shell it works fine and the object is indeed created.

However, when I do it in one of my custom management commands' script using the exact same code, there is no error but the object is never created开发者_如何学编程!!

Any ideas?


ok, solved it.

I used a keyboard interrupt to exit the script, and I'm guessing the script needs to exit correctly in order to finish the db transaction. I let it exit on itself and the objects were created.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜