django admin 联动查询
django-smart-selects
安装
pip install django-smart-selects
配置
-
INSTALLED_APPS 添加 "smart_selects" -
url.py修改
urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^chaining/', include('smart_selects.urls')), ) -
您还需要在每个包含smart_selects字段的页面中包含jQuery,或者在项目的settings.py中设置JQUERY_URL = True。
使用
model.py

页面展示

备注
JQUERY_URL : jQuery 2.2.0 is loaded from Google's CDN if this is set to True. If you would prefer to use a different version put the full URL here. Set JQUERY_URL = False to disable loading jQuery altogether.
USE_DJANGO_JQUERY : By default, smart_selects loads jQuery from Google's CDN. However, it can use jQuery from Django's admin area. Set USE_DJANGO_JQUERY = True to enable this behaviour.

浙公网安备 33010602011771号