Source

django-autocomplete-example / ac / views.py

Full commit
import django
import autocomplete
from django.http import HttpResponse
from django.shortcuts import render

from ac.forms import DummyForm

version = autocomplete.get_version()
django_version = django.get_version()

def example(request):
    is_valid = False
    if request.GET:
        form = DummyForm(request.GET)
        if form.is_valid():
            is_valid = True
    else:
        form = DummyForm()
    ctx = {
        'is_valid': is_valid, 'form': form,
        'version': version, 'django_version': django_version
    }
    return render(request, 'example.html', ctx)