Re: order_with_respect_to fail any workaround ?

2008-12-23 Thread Thierry Stiegler

I answer django developpers (http://groups.google.com/group/django-
developers/t/280bca5001faca07) so wait and see.

On 6 déc, 09:34, Thierry Stiegler  wrote:
> Hello,
>
> I got some errors by using the Meta optionsorder_with_respect_to:
> 
> 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
> 
>
> An I got this error :
> 
> Validating models...
> Unhandled exception in thread started by  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 
>     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 
>     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'
> 
>
> I found this ticket (http://code.djangoproject.com/ticket/2740), but I
> don"t want to patch django.AnyIdea for aworkaround?
--~--~-~--~~~---~--~~
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 at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: order_with_respect_to fail any workaround ?

2008-12-06 Thread Thierry Stiegler

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:
> 
> 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
> 
>
> An I got this error :
> 
> Validating models...
> Unhandled exception in thread started by  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 
>     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 
>     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'
> 
>
> 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 django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



order_with_respect_to fail any workaround ?

2008-12-06 Thread Thierry Stiegler

Hello,

I got some errors by using the Meta options order_with_respect_to:

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


An I got this error :

Validating models...
Unhandled exception in thread started by 
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 
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 
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'


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 django-users@googlegroups.com
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
-~--~~~~--~~--~--~---