mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #20228 - Documented unique_for_date and exclude behavior.
Thanks Deepak Thukral for the patch.
This commit is contained in:
parent
8365d76da0
commit
d321d1acf0
3 changed files with 41 additions and 3 deletions
|
@ -293,7 +293,12 @@ records with the same ``title`` and ``pub_date``.
|
|||
Note that if you set this to point to a :class:`DateTimeField`, only the date
|
||||
portion of the field will be considered.
|
||||
|
||||
This is enforced by model validation but not at the database level.
|
||||
This is enforced by :meth:`Model.validate_unique()` during model validation
|
||||
but not at the database level. If any :attr:`~Field.unique_for_date` constraint
|
||||
involves fields that are not part of a :class:`~django.forms.ModelForm` (for
|
||||
example, if one of the fields is listed in ``exclude`` or has
|
||||
:attr:`editable=False<Field.editable>`), :meth:`Model.validate_unique()` will
|
||||
skip validation for that particular constraint.
|
||||
|
||||
``unique_for_month``
|
||||
--------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue