def formfield(self, **kwargs): defaults = {'form_class': forms.CharField} defaults.update(kwargs) if defaults.get('widget') == admin_widgets.AdminIntegerFieldWidget: defaults['widget'] = admin_widgets.AdminTextInputWidget if defaults.get('widget') == admin_widgets.AdminBigIntegerFieldWidget: defaults['widget'] = admin_widgets.AdminTextInputWidget # noinspection PyCallByClass,PyTypeChecker return Field.formfield(self, **defaults)
def formfield(self, **kwargs): defaults = {'max_length': self.max_length, 'widget': RubricateWidget} kwargs.update(defaults) return Field.formfield(self, **kwargs)