1

I'm following the django-mptt tutorial here: http://django-mptt.github.io/django-mptt/tutorial.html#getting-started

I pip install'd django-mptt and then placed the directory (renamed mttp) in the same folder level as my app organizations.

Top level directory
* Secondary directory
** mptt (app level directory)
** organizations (app level directory)

In my app, organizations, I added the django-mptt code to models.py:

from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
from django.contrib.auth.models import User 

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

    class MPTTMeta:
        order_insertion_by = ['name']

class Organization(models.Model):
       ...

I run a syncdb and am told that "mptt" is synced, and then sync "organizations" with migrations as prompted, as I'm using South. No Genre table is created. How do I create the Genre table so I can add test data?

Amy Lam
  • 169
  • 1
  • 1
  • 13

0 Answers0