'Renders the field by rendering the passed widget, adding any HTML
attributes passed as attrs.  If no widget is specified, then the
field\'s default widget will be used.'

def as_widget(self, widget=None, attrs=None, only_initial=False):

    if (not widget):
        widget = self.field.widget
    if self.field.localize:
        widget.is_localized = True
    attrs = (attrs or {})
    auto_id = self.auto_id
    if (auto_id and (u'id' not in attrs) and (u'id' not in widget.attrs)):
        if (not only_initial):
            attrs[u'id'] = auto_id
        else:
            attrs[u'id'] = self.html_initial_id
    if (not only_initial):
        name = self.html_name
    else:
        name = self.html_initial_name
    return widget.render(name, self.value(), attrs=attrs)
