[pypy-dev] Django DateField default value and migrations fail

Sergey Kurdakov sergey.forum at gmail.com
Wed Aug 17 02:50:39 EDT 2016


Hi All,

there was a problem

https://bitbucket.org/pypy/pypy/issues/2062/inconsistency-in-__repr__-for-date-time

which caused Django not to make migrations
https://code.djangoproject.com/ticket/24779

and the problem was fixed

https://bitbucket.org/pypy/pypy/pull-requests/325/fixed-2062-treated-date-datetime-time/diff

but it works for correct migrations fine for default values for Django with
DateTimeField

say
class SomeClass(models.Model):
    date_add = models.DateTimeField(verbose_name=_('date created'),
default=timezone.now)

but code for DataField with default values

from datetime import date

class AnotherClass(models.Model):

    start_date = models.DateField(
        verbose_name=u'start date',
        default=date.today,
        )

    end_date = models.DateField(
        verbose_name=u'end date',
       default=date.today,
        )

still causes error of the kind:

topics/migrations/#migration-serializing" % (value, get_docs_version())
ValueError: Cannot serialize: <bound method type.today of <class
'datetime.date'

so somehow something else should be fixed in the same way it was done - but
I cannot figure out where to look at.
( and it works ok with standard Python and Django )

Any tips?

Regards
Sergey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20160817/d0ea42de/attachment.html>


More information about the pypy-dev mailing list