【发布时间】:2013-04-26 03:32:12
【问题描述】:
类似于get_or_create,我希望能够在Django 中update_or_create。
到目前为止,我使用的方法类似于@Daniel Roseman does it here。不过,我想更简洁地把它作为一种模型方法。
This snippet 已经很老了,我想知道在更新版本的 Django 中是否有更好的方法来做到这一点。
【问题讨论】:
-
这能回答你的问题吗? Create Django model or update if exists
标签: python django django-models django-orm