#22571: Document implications of using auto_now_add=True and get_or_create
-------------------------------------+-------------------------------------
     Reporter:  nu.everest@…         |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |                  Version:  1.4
    Component:  Documentation        |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  integrityerror       |      Needs documentation:  0
  auto_now_add get_or_create         |  Patch needs improvement:  0
  duplicatekey                       |                    UI/UX:  0
    Has patch:  0                    |
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by mardini):

 Note that your date_added is a DateTimeField, not a DateField, so it takes
 time into account. That's why using "today's date" won't match the
 existing value of date_added (since it's today's date + a particular
 time). If however some_datetime_obj in your first is exactly the same date
 and time, no new object will be created. If you don't want to consider the
 time in your get_or_create(), you can either use a DateField for
 date_added, or filter against year/month/day of your DateTimeField. So I
 think this ticket is invalid.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22571#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/078.1cfc73c4c89be5c63e1234c2659a0906%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to