Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 5944a9cc55d4fbbe9ed07bb700186dd2 > files > 46

python-django-ajax-selects-1.2.5-4.mga4.noarch.rpm

# -*- coding: utf-8 -*-

from django import forms
from django.forms.models import ModelForm
from ajax_select import make_ajax_field
from example.models import Release


class ReleaseForm(ModelForm):

    class Meta:
        model = Release

    #           args:  this model, fieldname on this model, lookup_channel_name
    group  = make_ajax_field(Release,'group','group',show_help_text=True)

    label  = make_ajax_field(Release,'label','label',help_text="Search for label by name")

    # any extra kwargs are passed onto the field, so you may pass a custom help_text here
    #songs = make_ajax_field(Release,'songs','song',help_text=u"Search for song by title")

    # testing bug with no help text supplied
    songs = make_ajax_field(Release,'songs','song',help_text="",show_help_text=True)

    # these are from a fixed array defined in lookups.py
    title = make_ajax_field(Release,'title','cliche',help_text=u"Autocomplete will suggest clichés about cats.")