D
D
Deleting Account2019-08-13 14:08:31
MySQL
Deleting Account, 2019-08-13 14:08:31

How to create such relation in Django 2?

Created a ForeignKey relation, and ran into a problem. I need to make the institution related to the model that is responsible for its type. For example, an enterprise has the type "
public catering establishment". In turn, this model has a ForeignKey relationship with the model that is responsible for the establishment's subcategory. For example, the type of establishment "public catering establishment" has subcategories "restaurant", "fast food", etc. In turn, I need to associate this model with the establishment model, but in such a way that when selecting a subcategory, only those cells in the database are displayed that match the institution type.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton R., 2019-08-13
@Andriy_Kosmenyuk

You need a link table between Types and Categories.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question