Hey, I have just installed the django-mptt lib, but i don't know how to get it to work :(
I have added
from mptt.models import MPTTModel
class Category(MPTTModel):
slug = models.SlugField(max_length=200, unique=True)
name = models.CharField(max_length=100)
parent = models.ForeignKey('self', blank=True, null=True, related_name='child')
It that works fine
-
But when i go to the Django Admin page of my site i got an error:
TemplateDoesNotExist at /admin/search/category/
admin/mptt_change_list.html
MPTT, or modified preorder tree traversal, is an efficient way to store hierarchical data in a flat structure. It is an alternative to the adjacency list model, which is inefficient.
django-mptt is a reusable Django app which aims to make it easy for you to use MPTT with your own Django models. It takes care of the details of managing a database table as a tree structure and provides tools for working with trees of model instances.
Set up your model A TreeForeignKey is just a regular ForeignKey that renders form fields differently in the admin and a few other places.
Googling this error message brought me here.
In my case solution was to simply add 'mptt' to INSTALLED_APPS for template loader to find admin/mptt_change_list.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With