Show select as a tree
<p>How to show categories as a tree in Django admin using MPTT?</p>

<p>I made it show list of categories as a tree:</p>

<p><a href="https://i.stack.imgur.com/ewc99.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ewc99.png" alt="enter image description here"></a></p>

<p>But it does not work when I try to create a new article:</p>

<p><a href="https://i.stack.imgur.com/P16ky.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P16ky.png" alt="enter image description here"></a></p>

<p>How do I make it render select as a tree?</p>

<p>Here is my model:</p>

<pre><code># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
from ckeditor.fields import RichTextField
from taggit.managers import TaggableManager
import os


class Category(MPTTModel):

    name = models.CharField(u'Заголовок', max_length=100, unique=False)
    parent = TreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True,
                            verbose_name=u'Родитель')

    class Meta:
        verbose_name = u'Мероприятие'
        verbose_name_plural = u'Мероприятия'

    class MPTTMeta:
        order_insertion_by = ['name']

    def __unicode__(self):
        return self.name


class Article(models.Model):
    category = models.ForeignKey(Category, on_delete=models.CASCADE, blank=False, verbose_name=u'Раздел')
    title = models.CharField(u'Содержание', max_length=120, blank=False)
    content = RichTextField(u'Содержание', blank=False)
    tags = TaggableManager(u'Тэги')

    class Meta:
        verbose_name = u'Новость'
        verbose_name_plural = u'Новости'
</code></pre>