django实现select2效果
效果图:
pip install django-select2-forms
在settings里面加上
INSTALLED_APPS = ( # ... 'select2', )
urls里面加上
urlpatterns = patterns('', # ... url(r'^select2/', include('select2.urls')), )
接下来把models里面的model外键改为
class Entry(models.Model): author = select2.fields.ForeignKey(Author, overlay="Choose an author...")