Questions tagged [mptt]

mptt refers to "Modified Preorder Tree Traversal" algorithm for storing hierarchical data

mptt refers to "Modified Preorder Tree Traversal" algorithm for storing hierarchical data.

See also:

146 questions
0
votes
0 answers

MPTT Algorith VS Data Normalization

Lets say I am trying to store addresses in a database that look like this: 123 Some Street Placeville, Idaho 83201, USA What would be the best practice way of storing this in a relational database like MySQL? Typically I would normalize it into…
Zexelon
  • 495
  • 5
  • 18
0
votes
1 answer

Filter product_set in django-mptt

Have 2 models class Category(MPTTModel): title = models.CharField() parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True) class Product(models.Model): category = models.ForeignKey(Category,…
kisean
  • 35
  • 2
  • 6
0
votes
1 answer

Django MPTT Filter Only if No Children Exist

So I am using MPTT for a Category model in Django, and I was wondering if there is a way to filter a Category if there is no child. models.py: class Category(MPTTModel, TimeStampedModel): title = models.CharField(max_length=75) parent =…
Hybrid
  • 6,741
  • 3
  • 25
  • 45
0
votes
2 answers

Django-mptt admin categories

In my Django project I have a model: class Category(MPTTModel): name = models.CharField(default='', max_length=50, verbose_name='Название') slug = models.SlugField(default='') parent =…
0
votes
1 answer

PHP need to display MPTT without modifying MySql database

I have a MPTT organized MySql database which i need to display , there is no level limit and i can't alter the database, i've tryed http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/, but still got me a few headeachs.
Decebal
  • 1,376
  • 1
  • 21
  • 36
0
votes
1 answer

Show select as a tree

How to show categories as a tree in Django admin using MPTT? I made it show list of categories as a tree: But it does not work when I try to create a new article: How do I make it render select as a tree? Here is my model: # -*- coding: utf-8…
Viktor
  • 4,218
  • 4
  • 32
  • 63
0
votes
1 answer

How to access ManyRelatedManager object attribute using mptt

What I got: class Category(MPTTModel): name = models.CharField(max_length=50, unique=True) slug = models.SlugField(unique=True) full_slug = models.CharField(max_length=256, null=True, blank=True) parent = TreeForeignKey('self',…
Kirill
  • 61
  • 1
  • 10
0
votes
1 answer

Update all parent id's in a SQL mptt table

consider a SQL table, which stores hierarchical data using MPTT (Modified Preorder Tree Traversal) method. CREATE TABLE node ( id SERIAL NOT NULL, -- primary key -- Nested mptt tree model. lft INT …
Haes
  • 12,891
  • 11
  • 46
  • 50
0
votes
1 answer

How to optimize slow Modified Preorder Tree Traversal query

I have a Modified Preorder Tree Traversal (MPTT) table with 82117 records. This mysql table contains some geographical data (Country, State, Region, City...) CREATE TABLE IF NOT EXISTS `geotree` ( `id` int(11) NOT NULL AUTO_INCREMENT, `geo_id`…
Ivan
  • 14,692
  • 17
  • 59
  • 96
0
votes
1 answer

MPTT Algorith Modification

I've got this algorithm to generate MPTT from my folder structure: https://gist.github.com/unbracketed/946520 Found on github and works perfectly for my needs. Currently I have requirement to add to it functionality of skipping some folders in tree.…
FiR3WaLL
  • 33
  • 1
  • 7
0
votes
1 answer

how does TreeBehavior works in cakephp 3

I'm following this http://book.cakephp.org/3.0/en/orm/behaviors/tree.html to make simple category tree. You can make a node a root in the tree by setting the ‘parent_id’ column to null: $aCategory = $categoriesTable->get(10); $aCategory->parent_id =…
Surjit Sidhu
  • 377
  • 4
  • 14
0
votes
1 answer

Converting adjacency list tables to MPTT in SQL Server 2008

Is there a helpful tool or script resource to aid conversion from old-school adjacency list tables to MPTT? I would have thought it was a problem faced by a few cleverer souls than I in the past, and thought I'd check here first in case they came up…
joshcomley
  • 28,099
  • 24
  • 107
  • 147
0
votes
0 answers

Kohana ORM-MPTT to hierarchical array

Respective All! Does anybody know method that retrieves me a MPTT tree as hierarchical array? Like follows: array ("1"=> array( "10"=> array("100"), "11" => array("110"=> array("1110") ) )…
Andrew
  • 57
  • 1
  • 8
0
votes
1 answer

Creating tree editor for mptt model in django admin

I'm trying to create a GUI editor for a configuration format using django admin. I don't really need to display anything on the main site, since the data in the admin will be used to generate configuration files. As part of this I need a way to add…
Paul Johnson
  • 1,329
  • 1
  • 12
  • 25
0
votes
1 answer

Get parent id in django-mptt

I am using django-mptt and jquery-treetable. I am printing my objects with: {% for node in nodes %} {% endfor %}
{{ node }}
In jquery-treetable the element should have some attributes to…
Jamgreen
  • 10,329
  • 29
  • 113
  • 224
1 2 3
9
10