On 17 August 2016 at 19:53, Yury V. Zaytsev <y...@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.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to