def __init__ self args kwargs super CategoryForm self __init__ args kw

1
2
3
4
5
6
7
8
def __init__(self, *args, **kwargs):
super(CategoryForm, self).__init__(*args, **kwargs)
if self.is_bound and kwargs.has_key('initial'):
initial = kwargs['initial']
bf = self.base_fields
bf['slug'].initial = initial['slug']
bf['slug'].widget.attrs['disabled'] = 'disabled'
bf['slug'].required = False