any_urlfield.forms

The AnyUrlField class

class any_urlfield.forms.AnyUrlField(url_type_registry, max_length=None, *args, **kwargs)

Form field that combines a Page ID and external page URL.

The form field is used automatically when the AnyUrlField is used in the model.

widget

alias of any_urlfield.forms.widgets.AnyUrlWidget

The AnyUrlWidget class

class any_urlfield.forms.AnyUrlWidget(url_type_registry, attrs=None)

The URL widget, rendering the URL selector.

The SimpleRawIdWidget class

class any_urlfield.forms.SimpleRawIdWidget(model, limit_choices_to=None, admin_site=None, attrs=None, using=None)

A wrapper class to create raw ID widgets.

It produces a same layout as the raw_id_fields = (field',) code does in the admin interface. This class wraps the functionality of the Django admin application into a usable format that is both compatible with Django 1.3 and 1.4.

The basic invocation only requires the model:

widget = SimpleRawIdWidget(MyModel)
label_and_url_for_value(value)

Optimize retrieval of the data. Because AnyUrlField.decompose() secretly returns both the ID, and it’s prefetched object, there is no need to refetch the object here.