Forms

class osm_field.forms.OSMFormField(*, max_length=None, min_length=None, strip=True, empty_value='', **kwargs)

Bases: osm_field.forms.PrefixedFormFieldMixin, django.forms.fields.CharField

class osm_field.forms.PrefixedBoundField(form, field, name)

Bases: django.forms.boundfield.BoundField

A bound field that passes the form’s prefix into the widget’s attrs

as_widget(widget=None, attrs=None, only_initial=False)

Render the field by rendering the passed widget, adding any HTML attributes passed as attrs. If a widget isn’t specified, use the field’s default widget.

class osm_field.forms.PrefixedFormFieldMixin

Bases: object

A form field that binds to a custom bound field class, so we can pass the form’s prefix into the widget’s attrs

get_bound_field(form, field_name)

For Django 1.9+

Return a BoundField instance that will be used when accessing the form field in a template.