from django import forms
from django.conf import settings

from .models import Page


TEMPLATE_CHOICES = getattr(settings, 'PAGE_TEMPLATES', (
    ('', 'Default'),
))


class PageAdminForm(forms.ModelForm):
    class Meta:
        model = Page
        exclude = ()

    def __init__(self, *args, **kwargs):
        super(PageAdminForm, self).__init__(*args, **kwargs)

        # The list of templates is defined in settings, however as we can't have dynamic choices in
        # models due to migrations - we change the form choices instead.
        self.fields['template_name'] = forms.ChoiceField(choices=TEMPLATE_CHOICES, required=False)

@@ -52,16 +52,54 @@
 ttings%0A%0A
+from mptt.forms import MPTTAdminForm%0A%0A
 from .mo
@@ -224,19 +224,17 @@
 orm(
-forms.Model
+MPTTAdmin
 Form

Extend PageAdminForm from MPTTAdminForm