Any idea how to use chained models ( A model field that depends on another model field)?

Hi Django gurus. Any idea how to use chained models ( A model field that depends on another model field)? A case example but not limited to is a selection of city that belongs to a particular SELECTED country. Please note I do not want to use 'django smart select' dependencies as it is out of maintenance for now. Thank you in advance
You already invited:

Stanley

Upvotes from: agrath

you could try overriding the Foreignkey field if you’re feeling adventurous. Looking at the ChainedKeyField in the existing `smart-selects` package, you could do something similar. Add a parameter for the model in parent foreignkey field. Then in the child field you modify the Autocomplete Widget. The most important thing will be modifying the autocomplete url to filter using the parent field’s id. Don’t know any way else currently.

If you wanna answer this question please Login or Register