From 291250f7b66a6b81d2fc64eecc82cb2b4bd6c090 Mon Sep 17 00:00:00 2001 From: Aaron Cannon Date: Fri, 3 May 2013 08:46:53 -0500 Subject: [PATCH] Added clarification to the docs, pointing out that unique_for_date only considers the date portion of DateTime fields. --- AUTHORS | 1 + docs/ref/models/fields.txt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/AUTHORS b/AUTHORS index 8cd86d38dc7..fb084f26cb8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -121,6 +121,7 @@ answer newbie questions, and generally made Django that much better: Chris Cahoon Juan Manuel Caicedo Trevor Caira + Aaron Cannon Brett Cannon Ricardo Javier Cárdenes Medina Jeremy Carbaugh diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index d322904ec9c..99ba78cb093 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -287,6 +287,9 @@ For example, if you have a field ``title`` that has ``unique_for_date="pub_date"``, then Django wouldn't allow the entry of two 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. ``unique_for_month``