def test_get_template_choices(self): self.assertEqual(( ('', '--------'), ('pages.landingpage', 'Pages | Landing Page'), ('pages.basicpage', 'Pages | Basic Page'), ('pages.otherpage', 'Pages | Some Other Page'), ), page_content.get_template_choices())
def __init__(self, *args, **kwargs): super(PageAdminForm, self).__init__(*args, **kwargs) self.fields['template'].choices = page_content.get_template_choices() self.fields['parent'].widget.can_add_related = False self.fields['parent'].widget.can_change_related = False if self.instance: self.fields['parent'].queryset = Page.objects.exclude( id=self.instance.id)
def test_get_template_choices(self): self.assertEqual(( ('', '--------'), ('pages.landingpage', 'Pages | Landing Page'), ('pages.basicpage', 'Pages | Basic Page'), ('pages.basicpagefunc', 'Pages | Basic Page Func'), ('pages.otherpage', 'Pages | Some Other Page'), ), page_content.get_template_choices())
def __init__(self, *args, **kwargs): super(PageAdminForm, self).__init__(*args, **kwargs) self.fields['template'].choices = page_content.get_template_choices()