'Django admin model field validation

I am developing a web application using django admin template. In that application I require a model field validation based on another model field input. Lets say an example, If the user provided "yes" as input value in a file_required model field, Browsefile model field should be considered as mandatory field. If the user provided "no" as input value in a file_required model field, Browsefile model field should be considered as optional. Please advise



Solution 1:[1]

If all you need is to create a const object like this

const Type A = {"type_a", {1, 2}};

i.e. an object that cannot be changed once it is initialized, then you merely need to remove constexpr from the constructor.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1