Commits

Germano Gabbianelli committed dd13bce

Comments (0)

Files changed (1)

-== Usage Example ==
+Django Autocomplete has been rewritten.
 
-for a more detailed example, see the [[http://bitbucket.org/tyrion/django-autocomplete/src/tip/ac_example/|demo application]].
+The old code is still available in the [[https://bitbucket.org/tyrion/django-autocomplete/src/7fb7340c20b4|0.X branch]] ([[Usage0.X|Usage Example for 0.X]]).
 
-urls.py
+== Django Autocomplete 1.0a ==
+
+Django Autocomplete 1.0a is a complete rewrite of [[http://bitbucket.org/tyrion/django-autocomplete/|Django Autocomplete]].
+
+Compared to django-autocomplete it has a better support for jQuery UI Autocomplete, it has a smarter Admin integration, and has a new MultipleAutocompleteWidget for ManyToMany fields. However support for YUI has currently been dropped (I hope to re-add it soon).
+
+=== Features ===
+
+* Uses [[http://jqueryui.com/demos/autocomplete/|jQuery UI Autocomplete]].
+* ForeignKey and ManyToManyField completition.
+* Completition for CharField, IntegerField and hopefully any Field.
+* Easy Admin integration.
+
+=== Documentation ===
+
+<<toc Documentation 4>>
+
+=== Usage Example ===
+
+Make the files under {{{autocomplete/media}}} accessible from
+{{{settings.AUTOCOMPLETE_MEDIA_PREFIX}}} (You can accomplish this by either
+linking or copying {{{autocomplete/media}}} in your project's media dir):
+
 {{{
 #!python
-from django.contrib.auth.models import User
-from autocomplete import autocomplete
 
-
-autocomplete.register('user', User.objects.all(), ('username', 'email'), 5)
-
-urlpatterns = patterns('',
-    url('^autocomplete/(\w+)/$', autocomplete, name='autocomplete'),
-    # other patterns
-)
+AUTOCOMPLETE_MEDIA_PREFIX = '/mysite/media/autocomplete/'
+# Remember to include the trailing slash!
 }}}
 
-forms.py
+Include the view in your **project**'s URLConf:
+
 {{{
 #!python
-from django import forms
-from django.contrib.auth.models import Message
-from autocomplete import ModelChoiceField
 
-class InsertMessage(forms.ModelForm):
-    class Meta:
-        model = Message
-
-    user = ModelChoiceField('user')
+from autocomplete.views import autocomplete
+    
+url('^autocomplete/', include(autocomplete.urls))
 }}}
 
-You can use AutoCompleteField/Widget even on the admin site.
+Register a couple of {{{AutocompleteSettings}}} objects and start using them (for
+example in admin.py):
+
+{{{
+#!python
+
+from django.contrib import admin
+from django.contrib.auth.models import Message
+    
+from autocomplete.views import autocomplete, AutocompleteSettings
+from autocomplete.admin import AutocompleteAdmin
+    
+class UserAutocomplete(AutocompleteSettings):
+    search_fields = ('^username', '^email')
+    
+autocomplete.register(Message.user, UserAutocomplete)
+    
+class MessageAdmin(AutocompleteAdmin, admin.ModelAdmin):
+    pass
+    
+admin.site.register(Message, MessageAdmin)
+}}}