Changes between Version 2 and Version 3 of Ticket #28715


Ignore:
Timestamp:
Oct 23, 2017, 5:53:37 AM (7 years ago)
Author:
Дилян Палаузов
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28715 – Description

    v2 v3  
    6262             if self.connection.features.requires_literal_defaults:
    6363diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
     64index 8d40c77..2f5d5c2 100644
    6465--- a/django/db/models/fields/__init__.py
    6566+++ b/django/db/models/fields/__init__.py
     
    6970         if self.auto_now_add:
    7071-            kwargs['auto_now_add'] = True
    71 +            kwargs['default'] = timezone.now
     72+            kwargs['default'] = datetime.date.today
    7273         if self.auto_now or self.auto_now_add:
    7374             del kwargs['editable']
    7475             del kwargs['blank']
     76@@ -1372,6 +1372,12 @@ class DateTimeField(DateField):
     77 
     78         return []
     79 
     80+    def deconstruct(self):
     81+        name, path, args, kwargs = super(DateTimeField, self).deconstruct()
     82+        if self.auto_now_add:
     83+            kwargs['default'] = timezone.now
     84+        return name, path, args, kwargs
     85+
     86     def get_internal_type(self):
     87         return "DateTimeField"
     88
    7589}}}
Back to Top