Questions tagged [django-mptt]

django-mptt is an implementation Modified Preorder Tree Traversal for handling trees of Django Model instances.

django-mptt is an implementation Modified Preorder Tree Traversal for handling trees of Django Model instances.

Useful links:

351 questions
2
votes
1 answer

Django MPTT maximum elements in recursetree

Is there a way to present a partial tree using Django-MPTT's {% recursetree %} without retrieving the entire tree from database? I need to show the first 20 nodes encountered by a Depth First Search. Either of these (which do not retrieve the full…
royron
  • 23
  • 1
  • 4
2
votes
1 answer

How to display tree structure with hyperlinks in django views

I have in my databases a table called nodes and where i have parent child relationship and i am using http://django-mptt.github.io/django-mptt/tutorial.html for nodes Now i can display all the nodes in the same and that is no problem. But what i…
fdsgds
  • 129
  • 6
2
votes
1 answer

South raises error when trying to switch model to django-mptt

I just installed django-mptt using PIP (meaning I have 0.5.5), changed an existing model ("Comment") to subclass from MPTTModel, and tried to do a schema migration with South, but South gave me the following error message: The field 'Comment.lft'…
2
votes
1 answer

Django-CMS and multiple menus

I have a number of top level pages that need splitting into two different menus. Using Django and Django-CMS what would the best way to do this? I have been reading through a number of Google threads and the most common suggestion is nesting the…
Lee
  • 5,816
  • 6
  • 45
  • 61
2
votes
1 answer

How do I get the last child in a django-mptt tree?

I want to access the latest object a django-mptt tree. Is it possible to do this from a django template?
Hobhouse
  • 15,463
  • 12
  • 35
  • 43
2
votes
1 answer

Django MPTT : Filter by depth?

I would like to know a thing about django-mptt, as I'm considering using it for a engineering coordination project. I would have a Model class (say, 'Interface'), with a ForeignKey to the Model (say, 'Location') in the Tree. Will I be able to filter…
pistache
  • 5,782
  • 1
  • 29
  • 50
2
votes
1 answer

Django mptt, extends "base.html"

In base.html:
user1682273
  • 147
  • 1
  • 4
  • 7
2
votes
1 answer

I'm looking for working example of django mptt

Does anyone has a working example of django mptt. I am not able to implement it. Maybe category system. Thanks
webfanks
  • 391
  • 2
  • 3
  • 11
1
vote
1 answer

Can MySQL constrain based on a NULL value combined with an id?

I use django-mptt to make a tree structure on a model in a web app. Unfortunately - once in a while I will get duplicate root nodes in a tree. These will have NULL as parent_id, and the same tree_id, like this: +--------+-----------+---------+ | id …
Bohr
  • 2,086
  • 3
  • 15
  • 19
1
vote
1 answer

django-cms: implementing a hierarchy-attached product list

I am considering using django-cms to implement the following scenario: Admins can create hierarchical pages, e.g.: cosmetics cosmetics/toothbrushes cosmetics/toothbrushes/electric In a separate interface, you can administrate the corresponding…
Joseph Tura
  • 6,290
  • 8
  • 47
  • 73
1
vote
3 answers

How do I add a trailing slash for Django MPTT-based categorization app?

I'm using Django-MPTT to develop a categorization app for my Django project. But I can't seem to get the regex pattern for adding a trailing slash that doesn't also break on child categories. Here's an example URL:…
Patrick Beeson
  • 1,667
  • 21
  • 36
1
vote
0 answers

VariableDoesNotExist at /blog/blog_posts/ Failed lookup for key

I trying to create categories with MPTT and I get this error: VariableDoesNotExist at /blog/blog_posts/Failed lookup for key [categories] in enter code here[{'True': True, 'False': False, 'None': None}, {}, {}, I know that I have to pass the…
fnuff
  • 69
  • 2
  • 9
1
vote
1 answer

Localization of the model with a tree-like structure

I'm new to python/django development and I'm stuck. I'm making a project on Django 4.0.4. I have a tree table in a SQLite database. In the admin panel, I configured it using the DraggableMPTTAdmin class from mptt. I also want to localize the fields…
Val Ko
  • 11
  • 2
1
vote
0 answers

Django-mptt get cumulative count of item inside each category

I'm using django-mptt. I'm trying to get all categories with the count of items inside each category. But I get this error: OperationalError at /items/ (1054, "Unknown column 'items_category.lft' in 'where clause'") From my view.py categories =…
oscurodrago
  • 788
  • 1
  • 8
  • 18
1
vote
0 answers

Django mptt: model with a mptt tree instance as a field

I am developing an app with Django where I have to model systems. A system is defined by a number of standard fields (name, owner, etc...) and then a tree of assets (implemented using mptt). A given asset can be part of several systems. A node in…
Otura
  • 31
  • 2