def widget_from_django_field(cls, f, default=widgets.Widget):
        """
        Returns the widget that would likely be associated with each
        Django type.

        Includes mapping of Postgres Array and JSON fields. In the case that
        psycopg2 is not installed, we consume the error and process the field
        regardless.
        """
        result = default
        internal_type = ""
        if callable(getattr(f, "get_internal_type", None)):
            internal_type = f.get_internal_type()

        if internal_type in cls.WIDGETS_MAP:
            result = cls.WIDGETS_MAP[internal_type]
            if isinstance(result, str):
                result = getattr(cls, result)(f)
        else:
            try:
                from django.contrib.postgres.fields import ArrayField, JSONField
            except ImportError:
                # ImportError: No module named psycopg2.extras
                class ArrayField:
                    pass

                class JSONField:
                    pass

            if isinstance(f, ArrayField):
                return widgets.SimpleArrayWidget
            elif isinstance(f, JSONField):
                return widgets.JSONWidget

        return result
Returns the widget that would likely be associated with each
        Django type.

        Includes mapping of Postgres Array and JSON fields. In the case that
        psycopg2 is not installed, we consume the error and process the field
        regardless.