google-code-export / django-mptt

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

MPTT not working with Django 1.0.2? #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here's my model that uses mptt:

class Discipline(models.Model):
    discipline = models.CharField(max_length=50,)
    information = models.TextField()

    def __unicode__(self):
        return self.discipline

mptt.register(Discipline)

I reset my app and syncdb'd, then started the django shell and imported my
models. When I try this...

physics = Discipline(discipline='Physics', information='whatever')
physics.insert_at(None)
Discipline.objects.all()

I get an empty list. Am I missing something?

I also tried adding through the django admin interface. When I try to save
a test discipline, it gives the error "'Discipline' object has no attribute
'parent'"

Any ideas?

What version of the product are you using? On what operating system?
Django 1.0.2
django-mptt SVN checked out earlier today (I deleted it from site-packages
and reinstalled so I know it's not old)
Windows Vista 64 bit
I'm using the django dev server and mysql

Original issue reported on code.google.com by whenther...@gmail.com on 10 Jul 2009 at 8:21

GoogleCodeExporter commented 9 years ago
I do believe that the default field for mptt is parent otherwise you will need 
to add
some metadata?

Original comment by skylar.s...@gmail.com on 18 Sep 2009 at 4:34

GoogleCodeExporter commented 9 years ago
1 - physics.save()
2 - You need to define a parent field on your model

These both seem to be working, closing

Original comment by craig.ds@gmail.com on 3 Sep 2010 at 11:12