Questions tagged [django-treebeard]

django-treebeard is a pluggable django app that implements efficient tree implementations

django-treebeard is a pluggable django app that implements efficient tree implementations:

  • Adjacency List
  • Materialized Path
  • Nested Sets
57 questions
2
votes
1 answer

wagtail 'Page with this Path already exists.' error on attempting to create page manually

I have some code to create a Custom page object as part of a data import: instance = PerformancePage( run=run, date=json_data['date'], time=json_data['time'], price=json_data['price'], title=f'{run.title} {json_data["date"]}…
hwjp
  • 15,359
  • 7
  • 71
  • 70
2
votes
1 answer

How do I use django-treebeard to build a sitemap?

I have setup a django-treebeard model that has child nodes and what not. How do I now display this in my template? This is what I have so far. My Models: class SiteMapEntry(MP_Node): name = models.CharField(max_length=100, null=False,…
DeA
  • 1,748
  • 3
  • 22
  • 41
2
votes
2 answers

Exception when trying to install Django-Treebeard based on instructions

I'm getting a non-descriptive (or at least I don't know how to interpret in this context) error message when sub-lassing from a Django-Treebeard node and am not sure how to debug. I'm using the installation instructions at:…
user265775
  • 39
  • 3
1
vote
1 answer

create data tree (including node.id) using django_treebeard

I'm trying to display a directory tree from a a treebeard model. The annotated list method suggested in the treebeard tutorial works fine, but I'd like to include id information in the data tree. The dump_bulk() has all the info I need, but as a…
Marg
  • 183
  • 1
  • 1
  • 6
1
vote
0 answers

How to get subordinates, recursively?

I have Django models for Organizational Units (OrgUnit) which can be company, department, team, etc., ie. it is a tree structure: from django.db import models from django.contrib.auth.models import User from treebeard.mp_tree import MP_Node,…
thebjorn
  • 26,297
  • 11
  • 96
  • 138
1
vote
1 answer

Large nested hierarchy in Django / Wagtail: parenting or categorizing?

I have a database containing metadata on 50,000 drugs (medications), which are ordered hierarchically (the taxonomy is called ATC). Example with a heart medication follows: A -- A10 ---- A10X, Metoprolol Some drugs have 4 levels. I need to…
LauperEd
  • 25
  • 3
1
vote
1 answer

Wagtail: Filter Page model by a field on the child

I have two models, ParentPage and ChildPage. I want to find the set of ParentPages where a field is_completed is True on the ChildPage. Normally in Django, I could do something like ParentPage.objects.filter(child_page__is_completed=True) However, I…
MDalt
  • 1,681
  • 2
  • 24
  • 46
1
vote
1 answer

Sorting email threads in django using mail header information

I have a django app that stores email threads. When I parse the original emails from an mbox and insert them into the database I include the email header parameters 'message-id' and 'in-reply-to'. The message-id is a unique string that identifies…
ajt
  • 1,341
  • 3
  • 13
  • 30
1
vote
0 answers

Configure Postgresql database to be used with Django treebeard

I am trying to use django-treebeard to manipulate hierarchical data with postgresql as the database. My current versions are : Django==3.0.4 django-treebeard==4.3.1 djangorestframework==3.11.0 So, the bug occurs when I make a node a child of…
1
vote
1 answer

Porting and existing nested set hierarchy

I have a nested set category table developed with the PHP ORM Doctrine and I would like to port it to a Django app. I started porting it to django-treebeard, but I am having difficulties and I am not sure it can work. The original table had the…
jphilip
  • 136
  • 2
  • 9
1
vote
1 answer

In django-treebeard, how to add child for sibling

In my project , i should use tree structure. after seeing documentation of treebeard ,i thought it is well suitable. thanks for providing clear documentation. In documentation, provided the example node = get(root.pk).add_child(name='Memory') …
user9955311
1
vote
0 answers

While trying to serialize child and parent nodes of a model, I get RecursionError

I am trying to make a comment model that supports an arbitrary number of replies. I am using Django Rest Framework and for comment trees I am using django-treebeard. This is my model code: class Comment(MP_Node): paylasan = models.ForeignKey( …
1
vote
0 answers

Django query to use output of one queryset value in another iteratively

I have one Organization model in which for each organization, I have to find it's parent organization's id. I can able to get the parent org's id for a single organization using this piece of code, child =…
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274
1
vote
1 answer

Multiple versions (revisions) of objects with django treebeard MP_Node Tree

I'm using Materialized Path tree (provided by django-treebeard) to create a tree structure ( https://bitbucket.org/hoverhell/xmppforum/src/27207da4a061/snapboard/models.py#cl-363 ). I'm trying to implement (recover) object (Post) editing that allows…
HoverHell
  • 4,739
  • 3
  • 21
  • 23
1
vote
2 answers

How do I use the django-cms Python api to create a page?

I'm trying to write a CMS content migration script that will create our pages for django-cms. However even with the default install of Django-cms, Django-treebeard keeps raising exceptions and it's not clear to me why. For example, when this line…