(field)
return False
We only allow to replace a widget with the floppyform counterpart if the
    original, by django determined widget is still in place. We don't want to
    override custom widgets that a user specified.
We only allow to replace a widget with the floppyform counterpart if the
    original, by django determined widget is still in place. We don't want to
    override custom widgets that a user specified.
We only allow to replace a widget with the floppyform counterpart if the original by django determined widget is still in place . We don t want to override custom widgets that a user specified .
def allow_floppify_widget_for_field(field):
    '''
    We only allow to replace a widget with the floppyform counterpart if the
    original, by django determined widget is still in place. We don't want to
    override custom widgets that a user specified.
    '''
    # There is a special case for IntegerFields (and all subclasses) that
    # replaces the default TextInput with a NumberInput, if localization is
    # turned off. That applies for Django 1.6 upwards.
    # See the relevant source code in django:
    #     https://github.com/django/django/blob/1.9.6/django/forms/fields.py#L261-264
    if isinstance(field, django.forms.IntegerField) and not field.localize:
        if field.widget.__class__ is django.forms.NumberInput:
            return True

    # We can check if the widget was replaced by comparing the class of the
    # specified widget with the default widget that is specified on the field
    # class.
    if field.widget.__class__ is field.__class__.widget:
        return True

    # At that point we are assuming that the user replaced the original widget
    # with a custom one. So we don't allow to overwrite it.
    return False
def allow_floppify_widget_for_field ( field ) : # There is a special case for IntegerFields (and all subclasses) that # replaces the default TextInput with a NumberInput, if localization is # turned off. That applies for Django 1.6 upwards. # See the relevant source code in django: #     https://github.com/django/django/blob/1.9.6/django/forms/fields.py#L261-264 if isinstance ( field , django . forms . IntegerField ) and not field . localize : if field . widget . __class__ is django . forms . NumberInput : return True # We can check if the widget was replaced by comparing the class of the # specified widget with the default widget that is specified on the field # class. if field . widget . __class__ is field . __class__ . widget : return True # At that point we are assuming that the user replaced the original widget # with a custom one. So we don't allow to overwrite it. return False