Changes between Initial Version and Version 1 of Ticket #27081


Ignore:
Timestamp:
Aug 17, 2016, 9:56:35 PM (8 years ago)
Author:
Sergey Kurdakov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27081 – Description

    initial v1  
    44
    55from datetime import date
    6 
     6{{{
     7#!python
    78class TestClass(models.Model):
    89
     
    1112        default=date.today,
    1213        )
    13 
     14}}}
    1415pypy migrations will fail
    1516
    16 django/db/migrations/writer.py", line 540, in serialize
    17     "topics/migrations/#migration-serializing" % (value, get_docs_version())
     17django/db/migrations/writer.py", line 540, in serialize   "topics/migrations/#migration-serializing" % (value, get_docs_version())
    1818ValueError: Cannot serialize: <bound method type.today of <class 'datetime.date'>>
    1919
     
    2626
    2727a solution for client code is to declare local function
     28{{{
     29#!python
    2830
    2931def today():
    3032    return date.today()
    3133
    32 but would be better to add types.MethodType check for pypy compatibility
     34
    3335class TestClass(models.Model):
    3436
     
    3739        default=today,
    3840        )
     41}}}
     42
     43but would be better to add types.MethodType check for pypy compatibility
Back to Top