I am trying to set the default values of a choice field on an inline based on the properties of the parent form / instance.
In pseudo code, it would look something like:
def get_form(self, ***):
if self.parent.instance && self.parent.instance.field_x == "y":
self.field_name.choices = ...
I've searched on Google but can't seem to find anything about referencing the parent form from within an inline.
Perhaps I have to do this the other way around, and access the inlines from within the parent?
def get_form(self, ***):
if self.instance:
for inline in self.inlines:
if instanceof(inline, MyInline):
inline.field_name.choices = ...
Are any of the above possible?