diff options
author | luxagraf <sng@luxagraf.net> | 2015-12-23 20:40:08 +0000 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2015-12-23 20:40:08 +0000 |
commit | 82ce53f7b8416be8e5fd964d62aa65239f5e3123 (patch) | |
tree | a9f112ddcaaef6f1bf4ac65bb623ff9f449f0784 /app/links/autocomplete_light_registry.py | |
parent | 1c5e35271ed54f0d5ea9d4a4ec9ebc39a345b429 (diff) |
added autocomplete to tag fields in Links admin
Diffstat (limited to 'app/links/autocomplete_light_registry.py')
-rw-r--r-- | app/links/autocomplete_light_registry.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/links/autocomplete_light_registry.py b/app/links/autocomplete_light_registry.py new file mode 100644 index 0000000..0781848 --- /dev/null +++ b/app/links/autocomplete_light_registry.py @@ -0,0 +1,24 @@ +import autocomplete_light.shortcuts as al +from taggit.models import Tag + +# This will generate a PersonAutocomplete class +al.register(Tag, + # Just like in ModelAdmin.search_fields + search_fields=['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', + }, +) |