google-code-export / django-mptt

Automatically exported from code.google.com/p/django-mptt
Other
0 stars 0 forks source link

'Category' object has no attribute 'n' #71

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I use Django 1.1.1 and last mptt from svn.

Tried example form documentation (only class name was changed):

>from django.db import models
>import mptt
>
>class Category(models.Model):
>    name = models.CharField(max_length=50, unique=True)
>    parent = models.ForeignKey('self', null=True, blank=True, 
>related_name='children')
>
>mptt.register(Category, order_insertion_by='name')

This code produces next exception: "'Category' object has no attribute 'n'"

At least I found the solution:
>mptt.register(Category, order_insertion_by=['name'])

So please fix code or documentation.

Original issue reported on code.google.com by ishalya...@gmail.com on 23 Apr 2010 at 8:43

GoogleCodeExporter commented 9 years ago
order_insertion_by (source checkout) now handles strings, tuples, lists

Original comment by craig.ds@gmail.com on 2 Sep 2010 at 12:47