A
A
andrewshkovskii2012-06-04 22:32:46
Django
andrewshkovskii, 2012-06-04 22:32:46

FK filtering in django model hierarchy?

Is it possible, and if possible, please give a small example of how you can filter possible Fk for a model in django with such a hierarchy:
(I don’t quite understand how this can be done through Limit_choices_to using Q () / F ())
Server < - Conf < - s_conf -> < - context
Server < - e_conf < - context
context_FK can only be cat. is in the e_conf model for the same Server for s_conf and e_conf;
Simply put, when creating an s_conf instance, I can only set the context_id for it, cat. is in the e_conf table for the same Server.
Through a form or a view is an option, but I would like it to be automatically validated through the shell and in the code too.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question