Issue #24 invalid
bmeyer71 NA
created an issue

I am having a problem following the documentation to configure this. It seems to conflict with the Usage example. I am using Django 1.2.5 at the moment and looking to migrate to 1.3 shortly.

I am unclear where the sample code **autocomplete_instance.register("cities", CitiesSettings)** should go or if it is the correct syntax as the Usage example only states autocomplete not autocomplete_instance.

How do you then get this to be available in the models.py? Do you use it as a widget or is it a search field of some sort?

Comments (1)

  1. Germano Gabbianelli repo owner

    autocomplete.views.autocomplete is the default AutocompleteView instance, and you should include it only in your project urlconf.

    If you need an autocomplete view for a specific application you should define a new AutocompleteView instance in your views.py and then include it in your app's urls.py:

    # views.py
    from autocomplete.views import AutocompleteView
    my_autcomplete = AutocompleteView("myapp")
    
    # urls.py
    from myapp.views import my_autocomplete
    ...
    

    Then once you added your autocomplete view to your urlconf and configured it with some AutocompleteSettings (for example with my_autocomplete.register("myid", MySettings)), then you can use an AutocompleteWidget in your forms simply passing to it an "autocomplete id" and an autocomplete view, so continuing the previous example:

    AutocompleteWidget("myid", my_autocomplete)
    

    Anyway if you have problems using autocomplete, you should just send me a private message, opening a ticket is not appropriate.

  2. Log in to comment