'Build HTML attributes for the widget.'

def build_attrs(self, *args, **kwargs):

    attrs = super(WidgetMixin, self).build_attrs(*args, **kwargs)
    if (self.url is not None):
        attrs['data-autocomplete-light-url'] = self.url
    autocomplete_function = getattr(self, 'autocomplete_function', None)
    if autocomplete_function:
        attrs.setdefault('data-autocomplete-light-function', autocomplete_function)
    return attrs
