I'm working on legacy code which is in Django (1.11)
I have a model A, with attributes:
Model_A:
Name (NOT NULL)
City (NOT NULL)
FieldX (Nullable) - CharField
And a model B, with attributes:
Model_B:
Name (NOT NULL)
City (NOT NULL)
RelatedField (ForeignKey to an instance of Model_A)
Now, When I add a record for Model_A
then I may NOT need to fill FieldX.
However, When I add a record for Model_B
then I'll have to select an instance of Model_A
and then if FieldX
of that instance is NULL
then I have to fill that as well (make it mandatory).
The form for Model_A
is pretty straight forward.
But for Model_B
I need a form where:
- First an instance of
Model_A
is selected (Dropdown) - The input box for
FieldX
of instance selected in 1 is shown (Editable and mandatory to fill, blank=False). - The rest of the fields are shown (Name, City, FieldY).
Can this be done using the admin page? Or will I have to create proper forms and user flow for this?