Skip to content

Commit

Permalink
Tutorial: Run makemigrations before migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Jun 21, 2016
1 parent fc2317a commit 9e131f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ Set up your model
-----------------

Start with a basic subclass of MPTTModel, something like this::

from django.db import models
from mptt.models import MPTTModel, TreeForeignKey

class Genre(MPTTModel):
name = models.CharField(max_length=50, unique=True)
parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True)
Expand All @@ -83,8 +83,9 @@ other fields: ``level``, ``lft``, ``rght``, and ``tree_id``. These fields are ma

That ``MPTTMeta`` class adds some tweaks to ``django-mptt`` - in this case, just ``order_insertion_by``. This indicates the natural ordering of the data in the tree.

Now create your table in the database::
Now create and apply the migrations to create the table in the database::

python manage.py makemigrations <your_app>
python manage.py migrate


Expand Down

0 comments on commit 9e131f9

Please sign in to comment.