Ticket #29505: 29505.diff

File 29505.diff, 1015 bytes (added by Eugene Pakhomov, 6 years ago)
  • django/db/backends/base/schema.py

    diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py
    index a722e497c3..de4c293bbd 100644
    a b class BaseDatabaseSchemaEditor:  
    225225            default = datetime.now()
    226226            internal_type = field.get_internal_type()
    227227            if internal_type == 'DateField':
    228                 default = default.date
     228                default = default.date()
    229229            elif internal_type == 'TimeField':
    230                 default = default.time
     230                default = default.time()
    231231            elif internal_type == 'DateTimeField':
    232                 default = timezone.now
     232                default = timezone.now()
    233233        else:
    234234            default = None
    235         # If it's a callable, call it
    236         if callable(default):
    237             default = default()
    238235        # Convert the value so it can be sent to the database.
    239236        return field.get_db_prep_save(default, self.connection)
    240237
Back to Top