Here are the examples of the python api django.django_forms.HiddenInput taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
View Complete Implementation : test_forms.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : Kemaweyan
Copyright BSD 3-Clause "New" or "Revised" License
Author : Kemaweyan
def test_create_empty_form(self):
"""
Checks whether the 'model_clast' attribute of the 'object_id'
widget is None and the 'content_type' and 'object_id' widgets
are not hidden in empty normal form
"""
# create an empty form
form = forms.ImageAdminForm()
# check whether the 'model_clast' is None
self.astertIsNone(form.fields['object_id'].widget.model_clast)
# check whether widgets are not hidden
self.astertNotIsInstance(
form.fields['content_type'].widget,
django_forms.HiddenInput
)
self.astertNotIsInstance(
form.fields['object_id'].widget,
django_forms.HiddenInput
)
3
View Complete Implementation : test_forms.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : Kemaweyan
Copyright BSD 3-Clause "New" or "Revised" License
Author : Kemaweyan
def test_create_empty_form_popup(self):
"""
Checks whether the 'content_type' and 'object_id' widgets
are hidden in empty popup form (opened from another admin)
"""
# create an empty form with '_popup' initial
form = forms.ImageAdminForm(initial={'_popup': True})
# check whether widgets are hidden
self.astertIsInstance(
form.fields['content_type'].widget,
django_forms.HiddenInput
)
self.astertIsInstance(
form.fields['object_id'].widget,
django_forms.HiddenInput
)