227 | | if db_field.name in self.get_autocomplete_fields(request): |
228 | | kwargs['widget'] = AutocompleteSelect(db_field.remote_field, self.admin_site, using=db) |
229 | | elif db_field.name in self.raw_id_fields: |
230 | | kwargs['widget'] = widgets.ForeignKeyRawIdWidget(db_field.remote_field, self.admin_site, using=db) |
231 | | elif db_field.name in self.radio_fields: |
232 | | kwargs['widget'] = widgets.AdminRadioSelect(attrs={ |
233 | | 'class': get_ul_class(self.radio_fields[db_field.name]), |
234 | | }) |
235 | | kwargs['empty_label'] = _('None') if db_field.blank else None |
| 227 | if 'widget' not in kwargs: |
| 228 | if db_field.name in self.get_autocomplete_fields(request): |
| 229 | kwargs['widget'] = AutocompleteSelect(db_field.remote_field, self.admin_site, using=db) |
| 230 | elif db_field.name in self.raw_id_fields: |
| 231 | kwargs['widget'] = widgets.ForeignKeyRawIdWidget(db_field.remote_field, self.admin_site, using=db) |
| 232 | elif db_field.name in self.radio_fields: |
| 233 | kwargs['widget'] = widgets.AdminRadioSelect(attrs={ |
| 234 | 'class': get_ul_class(self.radio_fields[db_field.name]), |
| 235 | }) |
| 236 | kwargs['empty_label'] = _('None') if db_field.blank else None |