Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » South introspection doesn't get registrered [RSS Feed]

#1 Jan. 17, 2011 17:20:47

O.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

South introspection doesn't get registrered


Hello.

I am using a simple custom Model:

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)

And this is my introspection rule, which I add to models.py:

from south.modelsinspector import add_introspection_rules
from lib.thumbs import ImageWithThumbsField
add_introspection_rules(
[
(
(ImageWithThumbsField, ),
,
{
"verbose_name": ,
"name": ,
"width_field": ,
"height_field": ,
"sizes": ,
},
),
],
)

However, when trying to convert my app (named "core") to south, I get
"freeze" errors, like the rule wasn't registered:

! 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, readhttp://south.aeracode.org/wiki/MyFieldsDontWorkDoes anybody know why?

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 17, 2011 19:53:45

Ian C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

South introspection doesn't get registrered


On Mon, Jan 17, 2011 at 9:18 AM, OryBand <oryb...@gmail.com> wrote:
> Hello.
>
> I am using a simple custom Model:
>
> 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)
>
> And this is my introspection rule, which I add to models.py:
>
> from south.modelsinspector import add_introspection_rules
> from lib.thumbs import ImageWithThumbsField
> add_introspection_rules(
>    [
>        (
>            (ImageWithThumbsField, ),
>            ,
>            {
>                "verbose_name": ,
>                "name":         ,
>                "width_field":  ,
>                "height_field": ,
>                "sizes":        ,
>            },
>        ),
>    ],
>    )
>
> However, when trying to convert my app (named "core") to south, I get
> "freeze" errors, like the rule wasn't registered:
>
>  ! 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, readhttp://south.aeracode.org/wiki/MyFieldsDontWork>
> Does anybody know why?

Try changing the last line of your introspection rule, from
> )
to something like
)

It looks like South is not recognizing your field type, as it is using
a different package name than you are.

It may also need to be something like
'core.models.lib.thumbs.ImageWithThumbsField'
or
'core.models.ImagesWithThumbsField'
depending on how your package is structured.

At the very least, I'm pretty sure that the slashes you have in your
regex are incorrect, and won't ever match.

Regards,
Ian Clelland
<clell...@gmail.com>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » South introspection doesn't get registrered [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support