mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #16137 - Removed kwargs requirement for QuerySet.get_or_create
Thanks wilfred@, poirier, and charettes for work on the patch.
This commit is contained in:
parent
a64de33b79
commit
90af278203
5 changed files with 23 additions and 5 deletions
|
@ -1343,8 +1343,12 @@ get_or_create
|
|||
|
||||
.. method:: get_or_create(**kwargs)
|
||||
|
||||
A convenience method for looking up an object with the given kwargs, creating
|
||||
one if necessary.
|
||||
A convenience method for looking up an object with the given kwargs (may be
|
||||
empty if your model has defaults for all fields), creating one if necessary.
|
||||
|
||||
.. versionchanged:: 1.6
|
||||
|
||||
Older versions of Django required ``kwargs``.
|
||||
|
||||
Returns a tuple of ``(object, created)``, where ``object`` is the retrieved or
|
||||
created object and ``created`` is a boolean specifying whether a new object was
|
||||
|
|
|
@ -280,6 +280,9 @@ Minor features
|
|||
* The :exc:`~django.core.exceptions.DoesNotExist` exception now includes a
|
||||
message indicating the name of the attribute used for the lookup.
|
||||
|
||||
* The :meth:`~django.db.models.query.QuerySet.get_or_create` method no longer
|
||||
requires at least one keyword argument.
|
||||
|
||||
Backwards incompatible changes in 1.6
|
||||
=====================================
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue