def make_ajax_form(model,fieldlist,superclass=ModelForm):
    from ajax_select.fields import AutoCompleteField, \
                                   AutoCompleteSelectMultipleField, \
                                   AutoCompleteSelectField

    class TheForm(superclass):
        class Meta:
            pass
        setattr(Meta, 'model', model)

    for model_fieldname,channel in fieldlist.iteritems():

        field = model._meta.get_field(model_fieldname)

        if isinstance(field,ManyToManyField):
            f = AutoCompleteSelectMultipleField(channel,required=not field.blank)
        elif isinstance(field,ForeignKey):
            f = AutoCompleteSelectField(channel,required=not field.blank)
        else:
            f = AutoCompleteField(channel, required=not field.blank)

        # django internals are very difficult to work with.
        # it requires too much knowledge and is thus breakable
        TheForm.declared_fields[model_fieldname] = f
        TheForm.base_fields[model_fieldname] = f
        setattr(TheForm,model_fieldname,f)

    return TheForm
Parses the given string into a boolean.  If its already a boolean, its
dataset/ETHPy150Open caseywstark/colab/colab/apps/ajax_select/__init__.py/make_ajax_form--crossover with--dataset/ETHPy150Open prestodb/presto-admin/prestoadmin/main.py/_to_boolean