1. Germano Gabbianelli
  2. django-autocomplete

Commits

Germano Gabbianelli  committed a368403

  • Participants
  • Parent commits eb64681
  • Branches default

Comments (0)

Files changed (1)

File Usage0.X.wiki

View file
+== Usage Example ==
+
+for a more detailed example, see the [[http://bitbucket.org/tyrion/django-autocomplete/src/tip/ac_example/|demo application]].
+
+urls.py
+{{{
+#!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
+)
+}}}
+
+forms.py
+{{{
+#!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')
+}}}
+
+You can use AutoCompleteField/Widget even on the admin site.