The field lookup in the Ajax search was hard-coded instead of being based on 'value_attr' parameter.
Add {% csrf_token %} into the template of test.
Initialize a label element with the unicode value of the object.
A container next to the hidden input field is created to display the value of the related object if such object exists.
This container is also created but hidden if the value of the field is empty.
If a fk exists, the autocomplete search field is hidden.
A placeholder (to be localized) has been added to the autocomplete search field.
The search view can return the object unicode value if a pk is in the params.
update the value label when choosing a related object and hide the search input.
The search input is shown when the user click on the clear button next to the label value.
Add some css rules for the value container and clear button.