mirror of
https://github.com/django/django.git
synced 2025-12-23 09:19:27 +00:00
Fixed #36808 -- Required name argument in UniqueConstraint signature.
By trading ValueError for TypeError for omitted name arguments, we gain a little clarity.
This commit is contained in:
parent
73c987eb3b
commit
b172cbdf33
4 changed files with 4 additions and 3 deletions
1
AUTHORS
1
AUTHORS
|
|
@ -551,6 +551,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Jonas Lundberg <jonas.lundberg@gmail.com>
|
Jonas Lundberg <jonas.lundberg@gmail.com>
|
||||||
Jonathan Davis <jonathandavis47780@gmail.com>
|
Jonathan Davis <jonathandavis47780@gmail.com>
|
||||||
Jonatas C. D. <jonatas.cd@gmail.com>
|
Jonatas C. D. <jonatas.cd@gmail.com>
|
||||||
|
Jonathan Biemond <jonathan.biemond@gmail.com>
|
||||||
Jonathan Buchanan <jonathan.buchanan@gmail.com>
|
Jonathan Buchanan <jonathan.buchanan@gmail.com>
|
||||||
Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/>
|
Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/>
|
||||||
Jonathan Feignberg <jdf@pobox.com>
|
Jonathan Feignberg <jdf@pobox.com>
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ class UniqueConstraint(BaseConstraint):
|
||||||
self,
|
self,
|
||||||
*expressions,
|
*expressions,
|
||||||
fields=(),
|
fields=(),
|
||||||
name=None,
|
name,
|
||||||
condition=None,
|
condition=None,
|
||||||
deferrable=None,
|
deferrable=None,
|
||||||
include=None,
|
include=None,
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ ensures the age field is never less than 18.
|
||||||
``UniqueConstraint``
|
``UniqueConstraint``
|
||||||
====================
|
====================
|
||||||
|
|
||||||
.. class:: UniqueConstraint(*expressions, fields=(), name=None, condition=None, deferrable=None, include=None, opclasses=(), nulls_distinct=None, violation_error_code=None, violation_error_message=None)
|
.. class:: UniqueConstraint(*expressions, fields=(), name, condition=None, deferrable=None, include=None, opclasses=(), nulls_distinct=None, violation_error_code=None, violation_error_message=None)
|
||||||
|
|
||||||
Creates a unique constraint in the database.
|
Creates a unique constraint in the database.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1462,7 +1462,7 @@ class UniqueConstraintTests(TestCase):
|
||||||
def test_requires_name(self):
|
def test_requires_name(self):
|
||||||
msg = "A unique constraint must be named."
|
msg = "A unique constraint must be named."
|
||||||
with self.assertRaisesMessage(ValueError, msg):
|
with self.assertRaisesMessage(ValueError, msg):
|
||||||
models.UniqueConstraint(fields=["field"])
|
models.UniqueConstraint(fields=["field"], name="")
|
||||||
|
|
||||||
def test_database_default(self):
|
def test_database_default(self):
|
||||||
models.UniqueConstraint(
|
models.UniqueConstraint(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue