Browse files

Added clarification to the docs, pointing out that unique_for_date on…

…ly considers the date portion of DateTime fields.
  • Loading branch information...
1 parent d48b723 commit 291250f7b66a6b81d2fc64eecc82cb2b4bd6c090 @cannona cannona committed May 3, 2013
Showing with 4 additions and 0 deletions.
  1. +1 −0 AUTHORS
  2. +3 −0 docs/ref/models/fields.txt
View
1 AUTHORS
@@ -121,6 +121,7 @@ answer newbie questions, and generally made Django that much better:
Chris Cahoon <chris.cahoon@gmail.com>
Juan Manuel Caicedo <juan.manuel.caicedo@gmail.com>
Trevor Caira <trevor@caira.com>
+ Aaron Cannon <cannona@fireantproductions.com>
Brett Cannon <brett@python.org>
Ricardo Javier Cárdenes Medina <ricardo.cardenes@gmail.com>
Jeremy Carbaugh <jcarbaugh@gmail.com>
View
3 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
@aaugustin
Django member

Does unique_for_date work properly on DateTimeField when USE_TZ = True?

Since I wasn't aware of this feature a few minutes ago, I suspect it doesn't; if so, the docs shouldn't imply it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+portion of the field will be considered.
+
This is enforced by model validation but not at the database level.
``unique_for_month``

2 comments on commit 291250f

@cannona

Good point. We should probably have some tests to go along with this. I'll see what I can come up with.

@aaugustin
Django member

Filed here: https://code.djangoproject.com/ticket/20409

unique_for_date is explicitly documented to work with DateTimeField. This commit merely brought that fact to my attention.

Please sign in to comment.