Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7701633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:02:15+00:00 2026-05-31T23:02:15+00:00

I try for a little while set up django-mptt in my project. I took

  • 0

I try for a little while set up django-mptt in my project. I took a sample from tutorial and changed model acordingly which looks like this:

class Genre(MPTTModel):
pk = models.AutoField(primary_key=True)
name = models.CharField(max_length=50, unique=True)
parent = TreeManyToManyField('self', null=True, blank=True, related_name='children')

class MPTTMeta:
    order_insertion_by = ['name']

Unfortunately console prints out something like this:

/srv/tokedu/local/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/db/models/base.pyc in _set_pk_val(self, value)
    426 
    427     def _set_pk_val(self, value):
--> 428         return setattr(self, self._meta.pk.attname, value)
    429 
    430     pk = property(_get_pk_val, _set_pk_val)
/srv/tokedu/local/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/db/models/base.pyc in _set_pk_val(self, value)
    426 
    427     def _set_pk_val(self, value):
--> 428         return setattr(self, self._meta.pk.attname, value)
    429 
    430     pk = property(_get_pk_val, _set_pk_val)
RuntimeError: maximum recursion depth exceeded

I think django-mptt just not support TreeManyToManyField. Anyone had the same problem??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:02:16+00:00Added an answer on May 31, 2026 at 11:02 pm

    Nodes can’t have more than one parent. That fundamentally changes your data structure – it’s no longer a tree, it’s an arbitrary graph.

    django-mptt only handles trees. If you have a large graph database, you’ve got a very different problem. You might want to look into using a graph database rather than an RDBMS.

    AFAIK there’s no django apps which make graph structures easy, but then again I’ve never really needed to 🙂

    Useful links:

    • http://en.wikipedia.org/wiki/Graph_database
    • http://techportal.inviqa.com/2009/09/07/graphs-in-the-database-sql-meets-social-networks/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little Java project where I've set the properties of the class
I was doing a little test to try Ruby's pty and I can't get
I will try to explain the situation as it is a little bit more
Try running this in a .VBS file MsgBox(545.14-544.94) You get a neat little answer
Gut-feeling: It looks a little bit like two threads both try to initialise disk-based
I got a little problem. Sometimes, when I try to call the following code,
Ok, so I'll try to make that question a little more simple. The core
Okay, this scenario is a little complicated, but I will try to explain it
Sorry if the post title wasn't clear, I will try to explain a little
Okay so I've set up and tested a nice little WCF service. The client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.