Chooser widgets should be considered is_hidden=False

This commit is contained in:
Matt Westcott 2015-09-08 17:50:26 +01:00
parent 73dee9898c
commit 9efa3af564
2 changed files with 8 additions and 0 deletions

View file

@ -18,6 +18,10 @@ class TestAdminPageChooserWidget(TestCase):
)
self.root_page.add_child(instance=self.child_page)
def test_not_hidden(self):
widget = widgets.AdminPageChooser()
self.assertFalse(widget.is_hidden)
def test_render_html(self):
widget = widgets.AdminPageChooser()

View file

@ -68,6 +68,10 @@ class AdminChooser(WidgetWithScript, widgets.Input):
link_to_chosen_text = _("Edit this item")
show_edit_link = True
# when looping over form fields, this one should appear in visible_fields, not hidden_fields
# despite the underlying input being type="hidden"
is_hidden = False
def get_instance(self, model_class, value):
# helper method for cleanly turning 'value' into an instance object
if value is None: