autocomplete_light_registry.py 712 B

12345678910111213141516
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. import autocomplete_light
  4. from models import Member
  5. # This will generate a MemberAutocomplete class
  6. autocomplete_light.register(Member,
  7. # Just like in ModelAdmin.search_fields
  8. search_fields=[
  9. '^first_name', 'last_name', 'organization_name'],
  10. # This will actually data-minimum-characters which
  11. # will set widget.autocomplete.minimumCharacters.
  12. autocomplete_js_attributes={
  13. 'placeholder': 'Other model name ?', },
  14. )