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
1
vote
1 answer

Django: Creating categories using querysets/filtering

I'm trying to figure out if it's possible to create categories using custom filters. I am building an e-commerce app and I have set up my category model using mptt. I am importing a csv that creates my top level categories which works fine. The…
rcomiskey
  • 63
  • 9
1
vote
1 answer

show category and sub-categories in hierarchy

I am using django-mptt for category model. I want to show a list of categories and sub-categories as in the screenshot. The way I could show is all the list without any structure like below BEDROOM ITEMS ALMIRAH 2 PIECE ALMIRAH 3 PIECE…
Serenity
  • 3,884
  • 6
  • 44
  • 87
1
vote
0 answers

Attribute error '/posts/' 'Comment' object has no attribute '_mptt_meta'

I am following this example on how to set threaded comments with django_comments and django-mptt. I have followed most of it and the posted comments are working in admin but I am getting this error 'Comment' object has no attribute '_mptt_meta'. I…
jsonknightlee
  • 173
  • 1
  • 12
1
vote
0 answers

django ListView - Sort queryset by the order of mptt-TreeForeignKey field

I have the following two models. class Category(MPTTModel): name=models.CharField(max_length=75,null=False,blank=False, unique=True) parent=TreeForeignKey('self', null=True, blank=True, related_name='children') and class…
art
  • 1,358
  • 1
  • 10
  • 24
1
vote
2 answers

Unable to retrieve from Django database in deployed Heroku App

Hi guys I'm really stuck on something developing my website with Django/Heroku. (And also using mptt) I get the error: (again2 is the name of a table) DoesNotExist: again2 matching query does not exist. I get no errors when I run locally, but I…
nickynw
  • 35
  • 5
1
vote
1 answer

NoReverseMatch in django-machina, if forum's title contains Unicode characters

Installation was successful, forums and topics are fine, but there is a problem - if I post a topic with Unicode characters (e.g. Russian), there NoReverseMatch: NoReverseMatch at /forum/ Reverse for 'forum' with arguments '('', 6)' and keyword…
Антон Игин
  • 195
  • 1
  • 1
  • 12
1
vote
1 answer

Checking boxes for items passed through context in Django

I am using django-mptt with the following code to display a tree structure of categories, sub-categories (and so on) with checkboxes. The idea being that the user can choose which categories to use. {% load mptt_tags %}
    {% recursetree…
dlinx90
  • 855
  • 4
  • 14
  • 24
1
vote
1 answer

Is it possible to duplicate a django-mptt model?

Let's say I have a django-mptt model that looks like this: class Category(MPTTModel): name = models.CharField(max_length=50) parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True) These Categories…
dlinx90
  • 855
  • 4
  • 14
  • 24
1
vote
1 answer

VariableDoesNotExist at /list/ Failed lookup for key [nodes] in u"[

I'm having problem with Django MPTT my models is class Catalog(MPTTModel): name = models.CharField(verbose_name='name',max_length=256,blank=True ) name_slug = models.CharField(verbose_name='Name_slug',max_length=250,blank=True) parent =…
1
vote
1 answer

MPTT multiple parents breadcrumbs

Let's say I have a simple model set: class Category(MPTTModel): name = CharField(max_length=50) parent = TreeForeignKey( 'self', null=True, blank=True, related_name='children', db_index=True …
Viktor
  • 4,218
  • 4
  • 32
  • 63
1
vote
2 answers

TypeError: __init__() takes exactly 1 argument (4 given)

mptt-urls raises: TypeError at /activities/test/ __init__() takes exactly 1 argument (4 given) This is my url pattern: url(r'^(?P.*)/', mptt_urls.view(model='activities.models.Category', …
Viktor
  • 4,218
  • 4
  • 32
  • 63
1
vote
1 answer

Django MPTT duplicate key value violates unique constraint

I practice django-mptt and face problem Here is my models.py class Genre(MPTTModel): name = models.CharField(max_length=50, unique=True) parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True) I…
user2492364
  • 6,543
  • 22
  • 77
  • 147
1
vote
1 answer

django-mptt model instance does not support indexing

I'm trying to implement a simple file browser app using django-mptt this is my models.py class RootMPTT(MPTTModel): name = models.CharField(max_length =255) parent =…
Jayaram
  • 6,276
  • 12
  • 42
  • 78
1
vote
0 answers

Django-mptt registration for an existing model

I tried to apply mptt in my django program on a existing model using the method provided on the main site of mptt, which is as follow: import mptt from mptt.fields import TreeForeignKey from django.contrib.auth.models import Group # add a parent…
David Chen
  • 11
  • 4
1
vote
0 answers

multi level referal system with django and mptt

I'm trying to create a referal structure like this: I'm trying to use https://github.com/django-mptt/django-mptt/ Which is the best approach to structure the database? In a future I will be able to do query like…
beddamadre
  • 1,583
  • 2
  • 19
  • 40