- edited description
Using lambdas in model field arguments is not compatible with migrations
Issue #37
resolved
According to the documentation of migrations:
Django cannot serialize:
Nested classes
Arbitrary class instances (e.g. MyClass(4.3, 5.7))
Lambdas
The more complex example and the references of the documentation should mention it.
from django.db.models import CharField, DateField, ForeignKey, Model
from django.contrib.auth.models import User
from autoslug import AutoSlugField
class Article(Model):
title = CharField(max_length=200)
pub_date = DateField(auto_now_add=True)
author = ForeignKey(User)
slug = AutoSlugField(populate_from=lambda instance: instance.title,
unique_with=['author__name', 'pub_date__month'],
slugify=lambda value: value.replace(' ','-'))
Comments (3)
-
reporter -
See report #29
-
reporter - changed status to resolved
- Log in to comment