r/django•
rasetha

How to populate a DropDownList based on another DropDownList in django?

I have 2 models language and books. Language have choices. i gave that in languages model like

Languagemodel.py:

    langs = (
    ('T', 'Telugu'),
    ('H','Hindi'),
    )
  language =models.CharField(max_length=10, choices=langs, 
  blank=True)

similarly in books model, i have choices for each language. When i select a language Hindi in languages model, it should display the books which are in that language in Books model. How to implement this?

Posted Jul 31, 2017, 2:45 PM UTC · edited

04
Loading comments…