我正在使用Django 1.2.3
和South 0.7.3
。
我正在尝试将我的应用程序(名为core
)转换为使用Django-South。我有一个正在使用的自定义模型/字段,名为ImageWithThumbsField
. 它基本上只是django.db.models.ImageField
具有一些属性的ol',例如身高,体重等。
在尝试./manage.py convert_to_auth core
接收南方的冻结错误时。我不知道为什么,我可能错过了一些东西......
我正在使用一个简单的自定义模型:
from django.db.models import ImageField
class ImageWithThumbsField(ImageField):
def __init__(self, verbose_name=None, name=None, width_field=None, height_field=None, sizes=None, **kwargs):
self.verbose_name=verbose_name
self.name=name
self.width_field=width_field
self.height_field=height_field
self.sizes = sizes
super(ImageField, self).__init__(**kwargs)
这是我的内省规则,我将其添加到我的顶部models.py
:
from south.modelsinspector import add_introspection_rules
from lib.thumbs import ImageWithThumbsField
add_introspection_rules(
[
(
(ImageWithThumbsField, ),
[],
{
"verbose_name": ["verbose_name", {"default": None}],
"name": ["name", {"default": None}],
"width_field": ["width_field", {"default": None}],
"height_field": ["height_field", {"default": None}],
"sizes": ["sizes", {"default": None}],
},
),
],
["^core/.fields/.ImageWithThumbsField",])
这是我收到的错误:
! Cannot freeze field 'core.additionalmaterialphoto.photo'
! (this field has class lib.thumbs.ImageWithThumbsField)
! Cannot freeze field 'core.material.photo'
! (this field has class lib.thumbs.ImageWithThumbsField)
! Cannot freeze field 'core.material.formulaimage'
! (this field has class lib.thumbs.ImageWithThumbsField)
! South cannot introspect some fields; this is probably because they are custom
! fields. If they worked in 0.6 or below, this is because we have removed the
! models parser (it often broke things).
! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork
有人知道为什么吗?我究竟做错了什么?