.. index:: pair: Tests ; jQuery UI autocomplete pair: scrollbar ; jQuery UI autocomplete .. _jquery_ui_autocomplete: ============================= jQuery UI autocomplete test ============================= .. seealso:: - https://jqueryui.com/autocomplete/ - https://github.com/jquery/jquery-ui/tree/master/demos - https://github.com/jquery/jquery-ui/blob/master/demos/autocomplete/maxheight.html - https://www.npmjs.com/package/jquery-ui.autocomplete.scroll - https://github.com/anseki/jquery-ui-autocomplete-scroll .. contents:: :depth: 3 .. figure:: test_with_scrollbar.png :align: center jQuery UI with scrollbar (thanks https://github.com/anseki) Running the local Django web server ==================================== :: System check identified no issues (0 silenced). October 26, 2016 - 08:54:53 Django version 1.10.2, using settings 'projet_ajax.settings' Starting development server at http://127.0.0.1:8004/ Quit the server with CTRL-BREAK. The projects/forms.py module ============================= .. code-block:: python #!/usr/bin/python # -*- coding: utf8 -*- """The project's forms. """ from django import forms from .models import Project class ProjectChampionForm(forms.ModelForm): """The champion project form""" champions_choice_list = forms.CharField(max_length=100, help_text='type username or email') class Meta: model = Project fields = ('title', 'champions_choice_list', 'champion',) def __init__(self, *args, **kwargs): super(ProjectChampionForm, self).__init__(*args, **kwargs) self.fields['champions_choice_list'].label = "Update the champion" self.fields['champion'].widget = forms.HiddenInput() The HTML and JavaScript part (the Django Template) ==================================================== .. code-block:: Django {% load static %} {% load staticfiles %}