私はDjango 1.2.3
とSouth 0.7.3
を使用しています。Django-Southのイントロスペクションルールが機能しません
私のアプリ(core
)をDjango-Southに変換しようとしています。私はImageWithThumbsField
という名前のカスタムモデル/フィールドを持っています。それは基本的に、私は南の凍結エラーをreceieveただ老いなど
身長、体重、などいくつかの属性を持つdjango.db.models.ImageField
./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",])
これは私がreceieveエラーです:
! 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
誰もがなぜ知っていますか?私は間違って何をしていますか?
まだ回答を受け入れることができません。http://StackOverflow.comによると、2日以上待つ必要があります。 –
おそらくこの質問は、それがあまりにも注目を集めるにはあまりにも具体的ではありませんが、あなたが私の一日を救ったことを知っているだけです。私は解決に達するには何時間もかかりましたが、これはまったくトリックでした。 sidenoteと同じように、私のために働いたのは["^ myapp.thumbs.ImageWithThumbsField"、私のthumbs.pyがmyappディレクトリ内にあるためです。乾杯! – rlafuente
NP。喜んで助けてください。 :) –