Juste for precision I use the trunk.
On Dec 6, 9:34 am, Thierry Stiegler <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I got some errors by using the Meta options order_with_respect_to:
> <code>
> class Category(PublicationBase, LocalisationBase):
> ITEM_PER_PAGE = 12
> name = models.CharField(max_length=255)
> pictogram = models.ImageField(upload_to="categories", blank=True)
> old_id = models.PositiveIntegerField(blank=True)
> parent = models.ForeignKey("Category", blank=True, null=True)
>
> class Meta:
> ordering = ['name']
> order_with_respect_to = 'parent'
>
> def __unicode__(self):
> return self.name
> </code>
>
> An I got this error :
> <code>
> Validating models...
> Unhandled exception in thread started by <function inner_run at
> 0x010ABBF0>
> Traceback (most recent call last):
> File "C:\Python25\django-trunk\django\core\management\commands
> \runserver.py", line 48, in inner_run
> self.validate(display_num_errors=True)
> File "C:\Python25\django-trunk\django\core\management\base.py", line
> 249, in validate
> num_errors = get_validation_errors(s, app)
> File "C:\Python25\django-trunk\django\core\management
> \validation.py", line 28, in get_validation_errors
> for (app_name, error) in get_app_errors().items():
> File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 128, in get_app_errors
> self._populate()
> File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 57, in _populate
> self.load_app(app_name, True)
> File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 72, in load_app
> mod = __import__(app_name, {}, {}, ['models'])
> File "C:\www\zebest-3000.com\trunk\zebest3000\..\apps\messages
> \models.py", line 113, in <module>
> notification = get_app('notification')
> File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 111, in get_app
> self._populate()
> File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 57, in _populate
> self.load_app(app_name, True)
> File "C:\Python25\django-trunk\django\db\models\loading.py", line
> 72, in load_app
> mod = __import__(app_name, {}, {}, ['models'])
> File "C:\www\zebest-3000.com\trunk\zebest3000\..\apps\portail
> \models.py", line 50, in <module>
> class Category(PublicationBase, LocalisationBase):
> File "C:\Python25\django-trunk\django\db\models\base.py", line 153,
> in __new__
> new_class._prepare()
> File "C:\Python25\django-trunk\django\db\models\base.py", line 178,
> in _prepare
> setattr(opts.order_with_respect_to.rel.to, 'get_%s_order' %
> cls.__name__.lower(), curry(method_get_order, cls))
> AttributeError: 'str' object has no attribute 'get_category_order'
> </code>
>
> I found this ticket (http://code.djangoproject.com/ticket/2740), but I
> don"t want to patch django. Any Idea for a workaround ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---