Document.objects.create should raise NotUniqueError upon saving duplicate primary key (#1485)

This commit is contained in:
Ephraim Berkovitch
2017-02-27 16:42:44 +02:00
committed by Stefan Wójcik
parent 5f43c032f2
commit 398964945a
3 changed files with 17 additions and 14 deletions

View File

@@ -286,7 +286,7 @@ class BaseQuerySet(object):
.. versionadded:: 0.4
"""
return self._document(**kwargs).save()
return self._document(**kwargs).save(force_insert=True)
def first(self):
"""Retrieve the first object matching the query."""