summaryrefslogtreecommitdiff
path: root/bak/unused_apps/birds/autocomplete_light_registry.py
blob: 1cfa8814527d125ddfa342499913ca14d079d886 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import autocomplete_light.shortcuts as al
from .models import Bird

# This will generate a PersonAutocomplete class
al.register(Bird,
    # Just like in ModelAdmin.search_fields
    search_fields=['common_name','scientific_name'],
    attrs={
    # This will set the input placeholder attribute:
    'placeholder': 'Tags...',
    # This will set the yourlabs.Autocomplete.minimumCharacters
    # options, the naming conversion is handled by jQuery
    'data-autocomplete-minimum-characters': 1,
},
    # This will set the data-widget-maximum-values attribute on the
    # widget container element, and will be set to
    # yourlabs.Widget.maximumValues (jQuery handles the naming
    # conversion).
    widget_attrs={
        'data-widget-maximum-values': 4,
        # Enable modern-style widget !
        'class': 'modern-style',
    },
)