(widget, field=None)
return widget
Get an instance of django.forms.widgets.Widget and return a new widget
    instance but using the corresponding floppyforms widget class.

    Only original django widgets will be replaced with a floppyforms version.
    The widget will be returned unaltered if it is not known, e.g. if it's a
    custom widget from a third-party app.

    The optional parameter ``field`` can be used to influence the widget
    creation further. This is useful since floppyforms supports more widgets
    than django does. For example is django using a ``TextInput`` for a
    ``EmailField``, but floppyforms has a better suiting widget called
    ``EmailInput``. If a widget is found specifically for the passed in
    ``field``, it will take precendence to the first parameter ``widget``
    which will effectively be ignored.
Get an instance of django.forms.widgets.Widget and return a new widget
    instance but using the corresponding floppyforms widget class.
Get an instance of django . forms . widgets . Widget and return a new widget instance but using the corresponding floppyforms widget class .
def floppify_widget(widget, field=None):
    '''
    Get an instance of django.forms.widgets.Widget and return a new widget
    instance but using the corresponding floppyforms widget class.

    Only original django widgets will be replaced with a floppyforms version.
    The widget will be returned unaltered if it is not known, e.g. if it's a
    custom widget from a third-party app.

    The optional parameter ``field`` can be used to influence the widget
    creation further. This is useful since floppyforms supports more widgets
    than django does. For example is django using a ``TextInput`` for a
    ``EmailField``, but floppyforms has a better suiting widget called
    ``EmailInput``. If a widget is found specifically for the passed in
    ``field``, it will take precendence to the first parameter ``widget``
    which will effectively be ignored.
    '''
    if field is not None:
        create_widget = _django_field_to_floppyform_widget.get(
            field.__class__)
        if create_widget is not None:
            if allow_floppify_widget_for_field(field):
                return create_widget(widget)
    create_widget = _django_to_floppyforms_widget.get(widget.__class__)
    if create_widget is not None:
        return create_widget(widget)
    return widget
def floppify_widget ( widget , field = None ) : if field is not None : create_widget = _django_field_to_floppyform_widget . get ( field . __class__ ) if create_widget is not None : if allow_floppify_widget_for_field ( field ) : return create_widget ( widget ) create_widget = _django_to_floppyforms_widget . get ( widget . __class__ ) if create_widget is not None : return create_widget ( widget ) return widget