{"id":23604,"library":"django-smart-selects","title":"django-smart-selects","description":"A Django application to handle chained model fields, allowing dropdowns to be dynamically filtered based on parent selections. Current version 1.7.2 (2024). Release cadence: irregular, with minor patches.","status":"active","version":"1.7.2","language":"python","source_language":"en","source_url":"https://github.com/jazzband/django-smart-selects","tags":["django","chained-selects","dynamic-fields","admin"],"install":[{"cmd":"pip install django-smart-selects","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Runtime dependency","package":"django","optional":false}],"imports":[{"wrong":"from smart_selects.db_fields import ChainedForeignKey","symbol":"ChainedForeignKey","correct":"from smart_selects import ChainedForeignKey"}],"quickstart":{"code":"# models.py\nfrom django.db import models\nfrom smart_selects.db_fields import ChainedForeignKey\n\nclass Location(models.Model):\n    continent = models.CharField(max_length=100)\n\nclass Country(models.Model):\n    continent = models.ForeignKey(Location, on_delete=models.CASCADE)\n    name = models.CharField(max_length=100)\n\nclass City(models.Model):\n    country = ChainedForeignKey(\n        Country,\n        chained_field=\"continent\",\n        chained_model_field=\"continent\",\n        show_all=False,\n        auto_choose=True,\n        sort=True\n    )\n    name = models.CharField(max_length=100)\n\n# admin.py\nfrom django.contrib import admin\nfrom .models import City\n\nadmin.site.register(City)","lang":"python","description":"Basic usage: define a ChainedForeignKey in models and register in admin."},"warnings":[{"fix":"Avoid using limit_choices_to on chained fields.","message":"ChainedForeignKey does not work correctly with 'limit_choices_to' - the chain filtering overrides it. Use raw_id_fields instead if you need custom filtering.","severity":"gotcha","affected_versions":"all"},{"fix":"Remove the setting from settings.py.","message":"Setting SMART_SELECTS_USE_SELECCT2 in Django settings is deprecated as of 1.6.0; it is now always True.","severity":"deprecated","affected_versions":">=1.6.0"},{"fix":"Change imports to 'smart_selects.db_fields'.","message":"Versions before 1.5.3 used a different import path ('smart_selects.fields') which is removed in current versions.","severity":"breaking","affected_versions":"<1.5.3"},{"fix":"Use formset management form and ensure prefix is set.","message":"When using in formsets, the chained field may not update correctly because the JavaScript relies on element IDs. Ensure each form in the formset has a unique prefix.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.7.2':25 '2024':26 'admin':40 'allow':13 'applic':7 'base':19 'cadenc':28 'chain':10,35 'chained-select':34 'current':23 'django':2,6,33 'django-smart-select':1 'dropdown':14 'dynam':17,38 'dynamic-field':37 'field':12,39 'filter':18 'handl':9 'irregular':29 'minor':31 'model':11 'parent':21 'patch':32 'releas':27 'select':4,22,36 'smart':3 'version':24","created_at":"2026-05-01T08:08:39.415895+00:00","updated_at":"2026-05-01T08:08:39.415895+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'ChainedForeignKey' from 'smart_selects' (/tmp/tmpw1f10116/venv/lib/python3.12/site-packages/smart_selects/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.7.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jazzband/django-smart-selects","docs":null,"changelog":null,"pypi":"https://pypi.org/project/django-smart-selects/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}