[pypy-dev] Django DateField default value and migrations fail
William ML Leslie
william.leslie.ttg at gmail.com
Wed Aug 17 08:10:24 EDT 2016
On 17 August 2016 at 19:53, Yury V. Zaytsev <yury at shurup.com> wrote:
> On Wed, 17 Aug 2016, Sergey Kurdakov wrote:
>
>> class TestClass(models.Model):
>>
>> start_date = models.DateField(
>> verbose_name=u'start date',
>> default=today,
>> )
>>
>> so I just wrap required function call into function.
>
>
> You can, of course, use a lambda, i.e. `default=lambda: date.today()` which
> is to the same effect, but a bit shorter.
It doesn't work with a lambda; the serialiser writes code that looks
up the function by name.
--
William Leslie
Notice:
Likely much of this email is, by the nature of copyright, covered
under copyright law. You absolutely MAY reproduce any part of it in
accordance with the copyright law of the nation you are reading this
in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without
prior contractual agreement.
More information about the pypy-dev
mailing list