I created a class as described in the mptt docs
class Locations(MPTTModel):
title = models.CharField(max_length=100)
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
def __unicode__(self):
return self.title
I'm doing a form as written in the manual
class RealtyAdminModelForm(forms.ModelForm):
location = TreeNodeChoiceField(queryset=Locations.tree.all(),
level_indicator=u'+--')
class Meta:
model = Realty
But django gives the following error:
type object 'Locations' has no attribute 'tree'
Why is this so?
I don't understand why in docs (http://django-mptt.github.io/django-mptt/forms.html) "tree", but the right is "objects":
class RealtyAdminModelForm(forms.ModelForm):
location = TreeNodeChoiceField(queryset=Locations.objects.all(),
level_indicator=u'+--')
class Meta:
model = Realty