A
A
Alexander2016-05-20 08:51:31
Django
Alexander, 2016-05-20 08:51:31

How to load data from a garter in django-admin?

There are countries . Every country has its cities. It is necessary to make it so that when a user selects a country in the admin panel, his cities are automatically loaded into another select (html tag).
In general, this option is not good for me:
models.py

class Slider(models.Model):
    country = models.ForeignKey(Country, verbose_name="Страна")
    city = models.ForeignKey(City, verbose_name="Город")
    description = models.TextField(verbose_name="Описание тура")
    status = models.BooleanField(verbose_name="Статус")

or create an empty select in forms.py and intercept the change_form.html template so that it can be loaded there via ajax into the empty select created in forms.py
Are there any other ways to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oscar Django, 2016-05-20
@kentuck1213

https://github.com/digi604/django-smart-selects

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question