tickets: 8346
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8346 | 2008-08-15 15:52:23 | 2011-09-28 16:12:17 | 2022-03-06 03:42:00.663341 | Accepted | closed | Forms | dev | duplicate | overriding widget in ModelChoiceField doesn't work as expected | Using below custom ModelChoiceField will not use RadioSelect widget as expected. {{{ class MyModelChoiceField(forms.ModelChoiceField): widget = forms.RadioSelect }}} You can work around that issue by overriding __init__ like so: {{{ class MyModelChoiceField(forms.ModelChoiceField): def __init__(self, *args, **kwargs): return super(MyModelChoiceField, self).__init__(widget=forms.RadioSelect, *args, **kwargs) }}} I guess this is a bug either with ModelChoiceField or with the documentation. | nobody | derelm | 0 | 0 | 0 | 0 |