擅长:python、mysql、java
<p>create基本上也是这样。下面是create的源代码。</p>
<pre><code>def create(self, **kwargs):
"""
Creates a new object with the given kwargs, saving it to the database
and returning the created object.
"""
obj = self.model(**kwargs)
self._for_write = True
obj.save(force_insert=True, using=self.db)
return obj
</code></pre>
<p>它创建一个实例,然后保存它。</p>