B
B
blackbb2017-04-10 14:34:34
Django
blackbb, 2017-04-10 14:34:34

How to display subcategories in the Django admin, depending on the selected category?

Hello, are there any standard django tools for displaying (in the admin) subcategories depending on the selected category. When adding an object, there is a category "region" and "city" (foreign key for the region), when choosing a region, I want to make sure that only the cities of this region are in the city selection.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Mitrushchenkov, 2017-04-11
@blackbb

Hello. Back when I was doing django, I think I used this solution . Unfortunately, I don't have time to check right now, but try it - maybe it will help you.
Whether there are standard tools for this now - I can’t say, I haven’t worked with this framework for a couple of years, but at that time - it seems there wasn’t.

M
maxclax, 2017-04-20
@maxclax

Django doesn't have standard Ajax solutions. Since when choosing a specific region, the system from the backend should request cities for it.
You can write all this yourself, but does it make sense? As for me, it is better to take a ready-made solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question