﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22137	Widgets class should drop the is_hidden bool property	django@…	nobody	"To me, it seems somewhat unnecessary, here are the reasons why:

* In every place that `is_hidden = True` is set in `forms/widgets.py`, there is also a corresponding `input_type = 'hidden'` set. It seems like we should use one ''or'' the other for determining if a field is hidden (keep it DRY)
* `is_hidden`doesn't necessarily reflect whether the widget is actually an input of type `type='hidden'` or not
* `is_hidden` cannot be set in the `__init__()` method, whereas `input_type` can (by passing an `attrs={'type' : 'hidden' }` dict)

The scenario where I came across this was that I wanted to make a `DateInput` widget hidden in one of my `ModelForms`. A basic example:


{{{
# Model
class MyMod(models.Model):
    date = models.DateField()

# Form
class MyModForm(forms.ModelForm):
    class Meta:
          widgets = {
                      'date' : forms.DateInput(format=""%d/%m/%Y"", attrs={'type' : 'hidden'}) # I need to use a DateInput here because a HiddenInput does not format the date properly (this is probably another bug in Django - the default date format is the US %m/%d/%y and it seems very difficult to change)
          }

# Template
{% if field.field.widget.is_hidden %}
{{ field }}
{% else %}
{{ field.label }} // custom html stuff {{ field }}
}}}


The call in the template does not work, since the DateInput has `is_hidden = True`. What I have to do in my template is:

`{% if field.field.widget.is_hidden or field.field.widget.input_type == ""hidden"" %}`
 
Not quite as elegant. If `is_hidden` were to be a method, which would return something like:

{{{
def is_hidden(self):
     return self.input_type == ""hidden""
}}}

I think it would be a more reliable way of determining if a widget is hidden or not."	Cleanup/optimization	closed	Forms	dev	Normal	fixed		alasdair@…	Ready for checkin	1	0	0	0	0	0
