1👍
✅
Django’s manager will look for the same method on a QuerySet
in case that method does not exists in the Manager
. So it will call the .create()
method [Django-doc] on the underlying QuerySet
, which is implemented as [GitHub]:
def create(self, **kwargs): """ Create 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
It will thus create a model object with the passed keywords, and save it with force_insert=True
to slightly improve efficiency, and return the item created at the database.
Source:stackexchange.com