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
0
votes
1 answer

How use TreeEditor from feinCMS to my mptt model?

I try simple exsample from here http://www.feinheit.ch/media/labs/feincms/admin.html' models.py: class Locations(MPTTModel): title = models.CharField(max_length=100) parent = TreeForeignKey('self', null=True, blank=True,…
Atterratio
  • 445
  • 2
  • 9
  • 25
0
votes
1 answer

Django-mptt form "Attribute error"

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…
Atterratio
  • 445
  • 2
  • 9
  • 25
0
votes
1 answer

Django: Get all model instances of top level category

I've got a heirarchy like so: Parent Cat Sub Cat Item Sub Cat Item Item Parent Cat ... Having the name/instance of a parent category I'd like to get all items which are related to the parent cat. I'm currently…
KingFu
  • 1,358
  • 5
  • 22
  • 42
0
votes
2 answers

Django query mptt nodes selected by a user

I am new to Django, I used django-mptt so that users can select different genres. The tree has three levels and user chooses the root node genres in signup. The code for that is class Genre(MPTTModel): name = models.CharField(max_length=50,…
name
  • 571
  • 1
  • 7
  • 11
0
votes
0 answers

Django, how to save multiple form fields into a single model attribute

I have tree structure called Genre(three level hierarchy) which is related many to many with the user. The user selects the genre leaf nodes. The following is my model.py class Genre(MPTTModel): name = models.CharField(max_length=50,…
name
  • 571
  • 1
  • 7
  • 11
0
votes
1 answer

DJANGO: feinCMS missing mptt when trying to sync.db

I'm trying to setup an instance of FeinCMS to check it out. I've added the all the modules under INSTALLED APPS but when I run the command python manage.py syncdb I get the error Import Error: No module named mptt. What am I doing wrong? My…
thedeepfield
  • 6,138
  • 25
  • 72
  • 107
0
votes
1 answer

What is the correct way of dealing with a django model that is in many categories or sub categories

I'm unsure of the best way to design my models for this task. Searching around suggests that I need to use something like Django-MPTT. I am creating a listings application where any 'item' can be listed under multiple categories. From any category…
J T
  • 337
  • 1
  • 3
  • 14
0
votes
1 answer

In Django CMS how can I separate navigation nodes without children from those with?

I have a complex navigation which I'm building with Django CMS. In the navigation, there are three levels of pages. When rendering the level 2 navigation, I'd like to first display all level 2 pages that are leaf nodes in order, and then display all…
damon
  • 14,485
  • 14
  • 56
  • 75
0
votes
1 answer

Using MPTT do get_children in templates (at runtime)

my template receives a variable called categories, and I want to list the categories that are "sons" of its father categories this is my code in template {% for category,structure in categories|tree_info %} {% if structure.new_level %}
  • Walucas
    • 2,549
    • 1
    • 21
    • 44
  • 0
    votes
    1 answer

    Navigation Nodes in django-cms example

    Can you give me an example how can i use Navigation Nodes? Cannot find examples in documentation. There is this {{ node }} but where is it coming from? Particalarly i am intereisted in {{ node.is_leaf_node }}.
    Vladimir Nani
    • 2,774
    • 6
    • 31
    • 52
    0
    votes
    1 answer

    How do I build a queryset in django retrieving threads in which a user has posted?

    I'm making a threaded forum app using django-mptt. Everything is up and running, but I have trouble building one specific queryset. I want to retrieve posts which: are root nodes are posted by current_user or have a descendant posted by…
    Hobhouse
    • 15,463
    • 12
    • 35
    • 43
    0
    votes
    1 answer

    installing python mptt permission denied

    ~/Django-1.4.2/django-mptt-0.5.5$ python ./setup.py install running install running build running build_py running install_lib creating /usr/local/lib/python2.7/dist-packages/mptt error: could not create…
    Almog Dubin
    • 329
    • 2
    • 13
    0
    votes
    1 answer

    Django MPTT's template tags destroying HTML markup

    I'm using Django MPTT to handle my hierarchical Data in my Django application. I'd like to render a TreeView using the recursetree tag. However, with this code : {% recursetree system_list %}
  • {{ node.title }} {% if not…
  • pistache
    • 5,782
    • 1
    • 29
    • 50
    0
    votes
    1 answer

    Django mptt, category and subcategory system - Category has no field named 'parent'

    I would like created category and subcategory system using django mptt. My try: from django.db import models import mptt class Category(models.Model): name = models.CharField(max_length=255) category = models.ForeignKey('self', null=True,…
    webfanks
    • 391
    • 2
    • 3
    • 11
    0
    votes
    1 answer

    Django mptt and merging multiple objects

    I am working with django-mptt and I'm stuck. I want to get all objects for each category with all objects from descendant categories. I managed to achieve my goal but there is one problem - I won't be able to sort items because they are generated…
    Efrin
    • 2,323
    • 3
    • 25
    • 45
    1 2 3
    23
    24