migrations.CreateModel(
name='Log',
fields=[
('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
('action_time', models.DateTimeField(verbose_name='action time', editable=False, default=django.utils.timezone.now)),
('ip_addr', models.GenericIPAddressField(null=True, verbose_name='action ip', blank=True)),
('object_id', models.TextField(null=True, verbose_name='object id', blank=True)),
('object_repr', models.CharField(verbose_name='object repr', max_length=200)),
('action_flag', models.CharField(verbose_name='action flag', max_length=32)),
('message', models.TextField(verbose_name='change message', blank=True)),
('content_type', models.ForeignKey(null=True,
verbose_name='content type',
# to_field=django.db.models.deletion.SET_NULL,
blank=True,
to='contenttypes.ContentType')),
('user', models.ForeignKey(verbose_name='user',
to=settings.AUTH_USER_MODEL,
# to_field=django.db.models.deletion.CASCADE
)),
],
注释掉的这两行是出问题的地方
python 3.5
django 1.8
注释掉之后可以创建表,但是使用的时候报:
FieldDoesNotExist: User has no field named <function CASCADE at 0x0000000004427A60>