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

Yury V. Zaytsev yury at shurup.com
Wed Aug 17 05:53:12 EDT 2016


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.

> But this is a temporary solution. Would be great if there could be a 
> general one.

So does it work if you modify Django as William suggested? If yes, it 
sounds like this is better fixed in Django...

-- 
Sincerely yours,
Yury V. Zaytsev


More information about the pypy-dev mailing list