Name: django-ajax-selects
Owner: NYT Newsroom Developers
Description: jQuery UI-powered auto-complete fields for ForeignKey, ManyToMany and text fields
Forked from: crucialfelix/django-ajax-selects
Created: 2017-02-09 01:50:48.0
Updated: 2017-12-23 01:07:29.0
Pushed: 2016-12-19 12:26:58.0
Size: 998
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Edit ForeignKey
, ManyToManyField
and CharField
in Django Admin using jQuery UI AutoComplete.
http://django-ajax-selects.readthedocs.org/en/latest/
Define a lookup channel:
urapp/lookups.py
ajax_select import register, LookupChannel
.models import Tag
ister('tags')
s TagsLookup(LookupChannel):
model = Tag
def get_query(self, q, request):
return self.model.objects.filter(name__icontains=q).order_by('name')[:50]
def format_item_display(self, item):
return u"<span class='tag'>%s</span>" % item.name
Add field to a form:
urapp/forms.py
s DocumentForm(ModelForm):
class Meta:
model = Document
tags = AutoCompleteSelectMultipleField('tags')
Many thanks to all contributors and pull requesters !
https://github.com/crucialfelix/django-ajax-selects/graphs/contributors
Dual licensed under the MIT and GPL licenses: